Twitter Job Interview Question About Rainfall And Walls - Business Insider
Michael Kozakov is a computer science student at the University of Toronto, and he has also interned at Amazon. But a few weeks ago, he also applied to work at Twitter.
Luckily for us, he wrote a blog post about the experience. (At one point, he was asked, "is this an anagram of a palindrome?")
But because he was being considered for a coding position, Kozakov was asked to create a model for solving a math problem, in the form of code.
The problem at first glance seems incredibly easy. But it really separates the liberal arts students from the comp-sci nerds.
We've tried to simplify it as much as possible.
Look at the following picture, which represents a bunch of walls of different heights:
Kozakov says he was then asked, "Now imagine it rains. How much water is going to be accumulated in puddles between walls?" (SPOILER: The correct answer is at the very end of this blog post.)
Kozakov's solution involved writing a piece of code that would detect the maximum heights of each wall, and then filling in the water volume that would fall between them. It looks like this, obviously (given that the y-axis is not a wall):
Read full article from Twitter Job Interview Question About Rainfall And Walls - Business Insider
No comments:
Post a Comment