It's been decades since Albert Einstein uttered the now famous line: "In the middle of difficulty lies opportunity." But for entrepreneurs, it couldn't be a more contemporary statement.

Problem solving in the face of great odds is what entrepreneurship is founded on. The trouble is, success isn't preordained. Only a whip-smart few get off their knees to storm toward glory.

Here's how the leaders of four of the world's biggest companies brought their businesses back from the brink--and the lessons your company can learn from them:

Switching Gears

In 1985, when Apple fired Steve Jobs from the company he founded, the end would soon appear nigh. Under the weight of bloated product offerings, including Macintosh TV and Macintosh IIvi, Apple's core had softened so much that the press started writing the company's eulogy.

“One day Apple was a major technology company with assets to make any self respecting techno-conglomerate salivate, the next day Apple was a chaotic mess without a strategic vision and certainly no future,” wrote Time magazine.

Flash-forward nearly 30 years and Apple is the most valuable company on the planet--with a market capitalization hovering around a half-trillion dollars. So by what stroke of fortune did Apple return and then immensely surpass its earlier success?

With the return of Jobs by way of Apple’s purchase of Next, Jobs's startup computermaker, the turnaround was on its way. He quickly grabbed control of the company and took three decisive steps toward a brighter future:

1. Sleeping with the enemy: Jobs took a $150 million cash infusion from rival Microsoft in exchange for rights to ship Microsoft Office and Internet Explorer on the Macintosh.
2. Shifting the paradigm: Jobs turned away from Apple’s failing original vision of a computer-only company and began creating the cornerstone of the turnaround--iMacs, iPods, and iPhones.
3. Smashing roadblocks: At a time when conventional wisdom suggested shedding real estate, not acquiring it, Jobs opened Apple Stores--putting his products front and center.

Back to Basics

Like many companies through the years, IBM hasn't always lived up to its promise. In the early 1990s, the world's largest computer company at the time faced a variety of challenges. Among others, the recession was still taking its toll on customers and consequently IBM's bottom line. Also, mainframe computing--IBM's bread and butter--was being supplanted by desktops. The company would go on to report an $8 billion loss in 1993, the biggest corporate loss in history up to that point.

What did the company do? It went back to basics. And brought in a new CEO.

Under the leadership of Lou Gerstner, IBM shed businesses that had pushed it away from its core competencies and jettisoned redundant infrastructure. "The last thing IBM needs right now is a vision," said Gerstner, referring to his goal of getting IBM back to its former glory. IBM set its sights on three areas: hardware, a business-software line, and lucrative IT services. The ability to see a path, take decisive action, and simplify the organization helped stave off the worst.

Cutting Your Losses

In 2007, at the start of the worst financial disaster in modern times, General Motors, or GM, got a new nickname: Government Motors. The once-vibrant American carmaker was reporting anemic sales, and with the Great Recession kicking into full gear, the company's future looked grim. In 2008 and 2009, GM accepted a $51 billion infusion from the U.S. government to help keep it up and running during its reorganization.

As GM's CEO, Ed Whitacre tossed out much of the company's underperforming baggage. The learner company trimmed stalling brands such as Hummer, Pontiac, Saturn, and Saab from its lineup. It also discontinued its electric-powered Chevy Volt. GM reemerged from bankruptcy in 2009, and in December 2013, the company lost its embarrassing moniker, after the U.S. Treasury sold its remaining GM shares.

The company's current CEO, Mary Barra, is facing new challenges from the families of GM-car owners who were hurt or killed by allegedly faulty ignition switches.

Customers Are King

After an oft-criticized merger with Nextel Communications in 2005, Sprint Corporation was grappling with losses on the order of $29.6 billion and a dwindling subscriber base.

But after Dan Hesse took over the role of Sprint CEO in 2007 and implemented a new "Simply Everything" campaign in 2008, the company's fortunes began to turn.

Combined with his marketing acumen and a laserlike focus on customer service, Hesse helped the company reverse its subscriber losses. The company also diversified its services through its acquisition of Virgin Mobile USA. With that, Sprint moved into the prepaid market in 2010, and eventually returned to positive subscriber growth for the first time in three years.

Despite feeling recent competitive pressures from T-Mobile and other telecom competitors, Sprint is the third-largest wireless network operator in the U.S., as of the latest reading.