There are many qualities that unite entrepreneurs, but perhaps the most vital is a nearly irrational perseverance in the face of failure coupled with the ability to learn from past mistakes.

It’s clichéd, sure, but that’s because it’s true: Most startups fail. And so entrepreneurial success requires the ability to strike out and get back up to bat, making adjustments to position, strategy and timing after each miss (insanity, after all, is doing the same thing over and over again and expecting a different result).

Apoorva Mehta, the founder and CEO of Instacart, a same-day grocery delivery service, just hit a home run. Dubbed 'the Uber of grocery delivery,' Mehta’s company has been extensively profiled in The New York Times and that was before its announcement, in June, that it had raised $44 million in a Series B round led by Andreesen Horowitz. Aaron Levie, the founder and CEO of Box, and Sam Altman, the president of the tech incubator Y Combinator, are investors.

Related: Will Virtual Marketplaces Disrupt Your Industry Next?

Instacart taps into one of Silicon Valley’s hottest trends – the sharing economy, which has given rise to hot startups like Uber and Airbnb – and applies it to grocery delivery.

Unlike same-day services such as Peapod or AmazonFresh, which deliver groceries from their own warehouses, Instacart has no inventory. Instead, when you order groceries from the service (you can choose from a variety of local stores in your area), one of the company’s personal shoppers is alerted via smartphone of your order. He or she shops for your items and than delivers them to your door, often in less than an hour.

Like Uber drivers, Instacart's personal shoppers can choose when and where they’d like to work. There is also an Uber-like system in place for customers to rate shoppers and vice versa. Unlike Uber, Instacart faces no regulatory barriers to operate.

After Many Strikeouts, a $44 Million Home Run - Delivery Service

Customer Delivery
Image credit: Instacart

Related: On-Demand Grocery Startup Instacart Raises $44 Million From Big-Name Investors

Predictably, there was a series of strikeouts before Instacart. Mehta worked at Amazon for four years as a backend logistics engineer on supply chain infrastructure, but quit his job in 2010 to move to San Francisco and develop business ideas full time. “[Instacart] was not my first idea…I worked on 20 to 25 of them before this,” he says. “I tried to get traction for those products. But the result was always failure, failure and more failure.”

The most recent defeat, which involved a social network for lawyers called LegalReach, was particularly crushing. Mehta raised money and gathered a team before realizing that the startup was, in fact, a non-starter. “I didn’t know anything about lawyers when we started. Turns out, they don’t like technology, and they don’t like to share things.”

So Mehta adjusted his swing, and got up to bat again. “The experience taught me that you shouldn’t start a company just to start a company,” he says. “The reason should be to solve a problem that you truly care about.” Connecting lawyers? “Not something I cared about.”

Enter Instacart. Mehta hates grocery shopping. Not the world’s most pressing problem, admittedly, but it was an inconvenience he experienced personally, and knew many other people (particularly moms, the elderly, long-suffering office assistants) experienced as well.

Related: Airbnb Co-Founder: If Rejection Slows You Down, Entrepreneurship Isn't For You

Mehta’s experience working on supply chain infrastructure at Amazon taught him the value of dependable delivery times. “But there’s no face to Amazon,” he says. “With Instacart [shoppers] are people who are part of our community. That personal touch, in my opinion, is a huge edge.”

And so Mehta put his coding skills to use. As motivation, he swore off the grocery store until he could place the order via his app. On June 2, 2012 he placed the first order on Instacart, walked to the grocery store and delivered his own list of items back to his apartment. “Instacart was profitable from day one,” he jokes.

After Many Strikeouts, a $44 Million Home Run - Instacart Screenshot app

Instacart Screenshot
Image credit: Instacart

As the service’s user base grew (mostly through word of mouth), Mehta’s days were spent meeting and training potential shoppers at his local grocery store (he posted ads on Craigslist and Facebook). Nights were for coding and refining the app. There wasn’t much time for sleep.

Related: Shark Tank's Barbara Corcoran: 4 Things Successful Entrepreneurs Do

Instacart’s unorthodox inclusion into Y Combinator’s summer 2012 funding cycle is a classic tale of “How Persistence Pays Off” -- a story you can tell Mehta has down to a well-rehearsed script.

Here are the facts: He wanted to enter Instacart into Y Combinator, but he missed the application deadline by two months. Through referrals from friends and acquaintances, he reached out to as many Y Combinator partners as he could only to be told, again and again, that the incubator didn’t take late applicants. One partner, Gary Tan, told him “you can fill out the late application, but it’s nearly impossible now.”

Mehta latched on to a single word: Nearly. “He was saying I had a chance,” he remembers thinking, a la Lloyd Christmas. “I had to give it one more shot.” He wanted Tan to tangibly understand Instacart’s potential, and so he sent him a six-pack of beer through the service, receiving a call a few minutes later from a confused Tan. “I told him, this is Instacart,” Mehta remembers. “The next day he asked me to come in to YC to meet the partners.”

Related: 4 Hot Tech Startups to Watch in 2014

Things accelerated quickly from there. Mehta met his two cofounders, Max Mullen and Brandon Leonardo, at Y Combinator and the company raised $2.3 million in seed funding in October 2012, and an additional $8.5 million in Series A funding last summer.

Currently, Instacart is in 12 cities, and has more than 1,000 registered shoppers (the application process is intense: online tests, phone screenings, in-person interviews and sometimes, a test run. Mehta places the acceptance rate at around 15 percent). The recent $44 million infusion will be used to aggressively expand; the plan is 17 cities by the end of 2014, and to be in every major U.S. city by the end of 2015. Amazon Fresh, by comparison, is currently available only available in the Los Angeles, San Francisco and Seattle areas.

Mehta's ambitions are lofty: “The goal for Instacart has always been the next Amazon.com. Groceries are a great start, but we want to expand to other verticals as well.”

Despite his company’s meteoric growth, he doesn't yet consider Instacart a success. “We’re just getting started,” he says.

Related: How Your Business Can Get in on the Sharing Economy