I know a brilliant young kid who graduated from college a year ago and now works at a large investment bank. He has decided he hates Wall Street and wants to work at a tech startup (good!). He recently gave notice to his bosses, who responded by putting on a dog and pony show to convince him to stay. If he stays at the bank, the bosses tell him, he’ll get a raise and greater responsibility. Joining the technology industry, he’d be starting from scratch. He is now thinking that he’ll stay, despite his convincing declaration that he has no long term ambitions in finance.

Over the years, I’ve run into many prospective employees in similar situations. When I ask them a very obvious question: “What do you want to be doing in 10 years?” The answer is invariably “working at or founding a tech startup” – yet most of them decide to remain on their present path and not join a startup. Then, a few years later, they finally quit their job, but only after having spent years in an industry they didn’t enjoy, and that didn’t really advance them toward their long term ambitions.

How can smart, ambitious people stay working in an area where they have no long term ambitions? I think a good analogy for the mistake they are making can be found in computer science.

A classic problem in computer science is hill climbing. Imagine you are dropped at a random spot on a hilly terrain, where you can only see a few feet in each direction (assume it’s foggy or something). The goal is to get to the highest hill.

Consider the simplest algorithm. At any given moment, take a step in the direction that takes you higher. The risk with this method is if you happen to start near the lower hill, you’ll end up at the top of that lower hill, not the top of the tallest hill.

A more sophisticated version of this algorithm adds some randomness into your walk. You start out with lots of randomness and reduce the amount of randomness over time. This gives you a better chance of meandering near the bigger hill before you start your focused, non-random climb.

Another and generally better algorithm has you repeatedly drop yourself in random parts of the terrain, do simple hill climbing, and then after many such attempts step back and decide which of the hills were highest.

Going back to the job candidate, he has the benefit of having a less foggy view of his terrain. He knows (or at least believes) he wants to end up at the top of a different hill than he is presently climbing. He can see that higher hill from where he stands.

But the lure of the current hill is strong. There is a natural human tendency to make the next step an upward one. He ends up falling for a common trap highlighted by behavioral economists: people tend to systematically overvalue near term over long term rewards. This effect seems to be even stronger in more ambitious people. Their ambition seems to make it hard for them to forgo the nearby upward step.

People early in their career should learn from computer science: meander some in your walk (especially early on), randomly drop yourself into new parts of the terrain, and when you find the highest hill, don’t waste any more time on the current hill no matter how much better the next step up might appear.