Billionaire investor Warren Buffett doesn't focus on the short term when he buys a stock. Instead, he looks at what that company may bring to his portfolio over time. That's a great investment strategy no matter what the market is doing. But when the market is down, this strategy is particularly useful. It can keep you moving in the right direction along the investment path. Instead of fleeing the market, hang in there and buy stocks that may grow your portfolio over the long term.

So, in this month of October, as the bear market continues, how about picking up a couple of Buffett favorites? One is a leader in two high-growth markets. The other offers an interesting and low-risk way to bet on the healthcare market. Let's take a closer look at each.

1. Amazon

Amazon (AMZN -0.17%) is a leader in e-commerce and cloud computing. Both of these markets are forecast to grow in the double digits over the coming years. Right now, e-commerce -- like retail in general -- is tough. Higher inflation is weighing on Amazon's transport costs, and it's also hurting customers' wallets.

As a result, Amazon's earnings have suffered. The company has reported declines in operating income and operating cash flow. It's important to keep in mind that this situation won't last forever. Certain elements will ensure Amazon's recovery and growth in the world of e-commerce.

For example, the company has grown its Prime membership to more than 200 million members. These members are spending more and relying on Amazon for more and more services. So Prime should be a key to growth down the road.

Meanwhile, Amazon can rely on its second big business right now. Amazon Web Services (AWS) continues to report double-digit growth in sales and operating income.

AWS is the leading player in the cloud computing services market. And the business keeps on growing, adding new contracts and expanding worldwide. AWS can buoy Amazon through the tough times and truly lift earnings once the economic situation improves.

Amazon shares are trading at less than three times sales. This is close to the stock's cheapest by that measure in about five years. This is a bargain for a player with a track record of revenue growth -- and potential for more growth over the long term.

2. McKesson

I consider McKesson (MCK 0.48%) a rather safe investment because it doesn't face this major healthcare company risk: The possibility a potential drug or device will fail in development. That's because McKesson doesn't develop drugs or devices. Instead, McKesson distributes drugs and medical supplies and offers support services to biopharma companies, such as clinical trial or regulatory services.

Through these businesses, McKesson still benefits from the big plus the healthcare industry offers. That's the fact that people need medicines and related products regardless of the economic situation. This is reflected in McKesson's earnings. The company has increased revenue into the billions of dollars over time. And over the past decade, McKesson has generally reported annual profits -- and those have been in the billions of dollars too.

Today, McKesson is at a turning point -- one that looks positive. Lasy year, the company announced it would exit its European businesses to focus on high-margin areas. It's already agreed to sell or has sold in 11 of 12 of those geographic areas.

At the same time, McKesson is ramping up its presence in businesses that should add more to earnings down the road. In the most recent earnings call, McKesson said expanding in oncology and biopharma services will support its "long-term growth framework." 

Even as McKesson streamlines its business, it's still managed to maintain growth. In the recent quarter, total revenue increased 7% and adjusted earnings per diluted share climbed 5%. The company lifted its earnings per diluted share annual guidance too.

At the same time, McKesson's $1 billion in stock buybacks in the quarter and commitment to lifting dividends are two more reasons to be positive about this Buffett stock. This means McKesson is confident about its future. And its focus on dividends means investors are likely to benefit from passive income year after year.

Today, McKesson is trading for more than 15 times forward earnings estimates. Considering the company's growth plan, dividend policy, and overall profile, that's a very fair price to pay for a potentially big return over time.