Growth stocks have been hammered over the past year, and pandemic-era rallies have been undone, as inflation and interest rates have surged. Many of the best investments of 2020 and 2021 have turned into complete disasters.

In some cases, this reckoning has simply removed the excesses of the pandemic-era stock market. In other cases, it's created good deals for investors willing to buy and hold through economic uncertainty. For growth investors seeking a bargain, DigitalOcean (DOCN 1.36%) and PubMatic (PUBM -0.38%) look like great options.

1. DigitalOcean

Demand for cloud infrastructure is starting to falter as companies big and small look to reduce costs. In his annual letter to shareholders, Amazon CEO Andy Jassy warned of short-term headwinds facing Amazon Web Services as customers respond to a tough economy with efforts to optimize costs.

DigitalOcean is far smaller than AWS, and it focuses on a completely different type of customer. While AWS is focused on large enterprises, DigitalOcean woos developers and small businesses with its straightforward and simple cloud platform. There are pros and cons to this strategy.

The upside is that DigitalOcean's customers likely have less wasteful spending to rein in. AWS is big and complicated, with overlapping services and convoluted pricing schemes. For enterprise customers with thousands of cloud resources spread across many teams, it's all too easy to lose track of some virtual machines or databases.

Developers and small businesses using DigitalOcean, on the other hand, enjoy simple pricing models and probably have a better handle on the scope of their cloud spending.

The downside is that DigitalOcean's customer base might be more fickle. Plenty of smaller businesses will fail in an economic downturn, removing themselves from DigitalOcean's customer base. And because its customers run simpler cloud infrastructures, switching providers to potentially save money won't be as big an ordeal as a large enterprise moving from AWS to a competitor.

DigitalOcean will almost certainly feel some pain as economic conditions deteriorate, but given its size and its appeal among developers, the company should be able to maintain solid growth regardless. Revenue increases this year will likely be slower than the 34% growth DigitalOcean reported for 2022, but the company has the potential to fare better than the big cloud platforms.

The company wasn't profitable in 2022, but it did produce positive free cash flow. Valued at roughly 4.2 times revenue guidance for 2023, DigitalOcean stock looks like a good deal if you factor in the potential for the company to grow at a double-digit rate for many years. This year will be a test for sure, but the long-term picture looks bright.

2. PubMatic

Online publishers can try to sell ad space on their own, but they would likely be leaving money on the table. PubMatic's digital advertising platform solves this problem by aggregating publisher inventory and opening it up for bidding.

The advertising industry is sensitive to economic conditions, and that's true for online ads as well. While PubMatic grew revenue by 13% in 2022, it slumped a bit in the fourth quarter and will decline significantly to start 2023. The company does expect to grow faster than the digital ad market this year and gain market share, but the best-case scenario is sluggish growth.

While the company's growth is taking a breather right now, what makes PubMatic special is its incredible efficiency. Its fully owned and operated cloud infrastructure that is tailored to processing trillions of bids keeps costs down, leading to impressive profitability.

On $256.4 million of revenue in 2022, PubMatic produced $28.7 million of net income based on generally accepted accounting principles (GAAP) and $38.3 million of free cash flow (FCF). The company expects FCF to be roughly the same this year, despite the deteriorating economy.

With a market capitalization of just $710 million, PubMatic stock trades for less than 19 times FCF. Given the long-term growth potential -- the company thinks it can quintuple its market share in the long term -- that seems like a steal.

PubMatic's results won't be pretty this year, but revenue and profit growth should rebound along with the economy. With the stock's valuation in depressed territory, now is a great time to pick up shares.