One of the hardest things about investing is waiting. Waiting for the magic of compounding to do its thing is a particularly useful skill every investor should possess. But this skill will do you no good unless you pick the right stocks to add to your portfolio. By contrast, the combination of time and investing in great businesses remains one of the best ways to grow your wealth over the long term. And if that's your goal, then two companies that can help you reach it are DexCom (DXCM 2.52%) and Pinterest (PINS 0.95%). Let's see why both stocks are worth investing in.

DXCM Chart

DXCM data by YCharts.

1. DexCom

The future of DexCom, a maker of medical devices, is tied to the unfortunate rise in the number of people who have diabetes. The company's G6 continuous glucose monitoring (CGM) system -- the sales of which generate the bulk of its revenue -- simplifies the life of diabetes patients by helping them keep track of their blood glucose levels in real time, eliminating the need for painful finger sticks.

DexCom's G6 CGM system is associated with better health outcomes for diabetes patients. In its latest quarterly update, the company reported the results of a randomized trial pitting G6 users against diabetes patients on finger sticks, which are the current standard of care. The study showed that G6 users spent an additional four hours per day in the target glucose range compared to finger-stick users, among other positive results. 

Increased adoption of CGM technology has been a key growth driver for DexCom in the past. And any technology that improves health outcomes is bound to have some success. 

Doctor measuring patient's blood glucose level.

Image source: Getty Images.

However, there remains a long runway for growth in this market. Estimates vary, as they always do, but they all point in the same direction: rapid growth of the CGM market. Research company Mordor Intelligence sees the industry expanding at a compound annual growth rate of 14% through 2026.

Meanwhile, DexCom is developing the G7, a newer, better, and smaller device. The company has also worked hard to integrate its CGM systems with automatic insulin delivery devices, such as Tandem Diabetes Care's t:slim X2 insulin pump. As DexCom continues to find new and better ways to serve patients with diabetes, the company's financial results -- and its stock price -- will continue rising. 

And although its shares have underperformed the market in the past year, the company has provided market-beating returns when looking at a longer period. I wouldn't bet against DexCom from here on out. In fact, I fully expect the healthcare company to beat the market, which is why I think its stock is a buy right now. 

2. Pinterest

Shares of social media platform Pinterest fell sharply after the company reported its financial results for its second quarter, which ended on June 30. On the one hand, it isn't hard to understand why. Although Pinterest's revenue soared by 125% year over year to $613.2 million, its monthly active users (MAUs) in the U.S. -- its most important market -- dropped by 5% to 91 million.

What's more, Pinterest warned investors of slower revenue growth in the third quarter. It's not too surprising that some of these metrics spooked the market. But in my view, Pinterest remains a top growth stock worth buying. First, its business got a boost last year as a result of the pandemic. At some point, this tailwind was always going to come to a halt. As CEO Ben Silbermann said: 

The pandemic was an unprecedented and unique global event. In past earnings calls, we talked about how stay-at-home orders significantly increased usage of Pinterest. And for the past year, we've highlighted how people came to Pinterest for inspiration to reinvent their lives during such a difficult time. Now as the world opens up, we're seeing the similar effect in the opposite direction.

Three sticky notes labeled "like," "follow," "share."

Image source: Getty Images.

As the pandemic gradually fades into the rearview mirror, Pinterest user growth in the U.S. should pick up. Meanwhile, the company is constantly looking for ways to please users on its platform and businesses that come looking for customers.

On the user side, Pinterest provides a unique experience among social media platforms. Pinners, as they are called, express themselves primarily through pictures and videos, which they can organize and save. Pinterest even has a visual search tool to help users find what they are interested in without going through the trouble of typing a description of the item. For businesses, Pinterest provides analytic tools for the performance of ads (conversion rates and the like), ad automation tools, and more. 

The company's efforts to attract both individuals and businesses to its platform have worked so far, and in my view, they will continue to bear fruit. This will translate to continuous top-line growth for the company, and while it is not yet profitable, I believe it is worth overlooking the red ink on the bottom line for now. In the long run, this tech stock looks more than likely to deliver market-beating returns.