Killer Interview Question: Code An Efficient Way To Calculate Puddle Sizes

Many of the killer interview questions we’ve featured before would apply in any job. For developer roles, you’ll often be asked to write code to solve a particular problem. As student Michael Kozakov discovered when being interviewed by Twitter, the kicker is that you have to write not just functional code, but the most efficient code.

Kozakov was asked to write code to calculate the amount of rain that would catch between a group of buildings with arbitrary heights. He came up with what he thought was an effective method, but his interviewer promptly pointed out that while that approach would work, it required two passes through the data, and it should be possible with just one pass. After the interview was over, Kozakov realised that the approach he had coded wouldn’t actually produce the right answer in all cases.

Kozakov’s blog post runs through the full mathematics if you’re curious. The bigger takeaway is that advanced developer jobs require both imaginative thinking and sound mathematical skills, not merely experience with a specific platform.

I Failed A Twitter Interview [Michael Kozakov via Business Insider]

The Cheapest NBN50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.


4 responses to “Killer Interview Question: Code An Efficient Way To Calculate Puddle Sizes”