Interview Questions: N closest points – 1

Software development and other animals

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

Advertisements
Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s