Recently I failed an interview with a company everybody knows. No, it wasn’t Google. No, not Microsoft either. (OK, maybe not everybody… ALMOST everybody). Anyway, I’m not saying.
The aim was to see how large US companies hire developers. It’s not a secret that the process differs a lot from what we have in Ukraine and therefore, their process is intimidating for us. So, I wanted to experience it.
Today I want to write about one interview task and several ways to solve it. Imagine you have N points on the plane, and they’re distributed according to a principle unknown to you. You have a base point, call it A, and your task is to find K points closest to A. How would you go about it? Think about the algorithms and data structures you would use.
The bruteforce way of doing it is as follows:
1) you create a…
View original post 199 more words