K Closest Points to Origin (Python)

K Closest Points to Origin (Python)

Interview Summary

Problem type
Vertex distance order statistic

Interview question

  1. Given a list of points as [x,y] pairs; a vertex in [x,y] form; and an integer k, return the kth closest points in terms of Euclidean distance
  2. Assuming that the dataset is too big to store in memory, rewrite functions for distributed system

Interview Feedback

Feedback about Mythic Borogove (the interviewee)
Advance this person to the next round?
:thumbsup: Yes

Technical skills
4/4

Problem solving ability
4/4

Communication ability
4/4

It was a pleasure interviewing with you. Tbh, I don't have any solid feedback to give you. You did phenomenal in this interview. You were really quick, clarified all edge cases in the beginning. Started with the simple solution and optimized with (with a little hint). Then when changing the requirement to use a map-reduce you nailed it right away...

Feedback about Indelible Raven (the interviewer)
Would you want to work with this person?
:thumbsup: Yes

How excited would you be to work with them?
3/4

How good were the questions?
3/4

How helpful was your interviewer in guiding you to the solution(s)?
4/4

Problem was well explained, hints were dispensed at good intervals, and interviewer had patience to let me think through things...

Interview Transcript

Indelible Raven: Hi.
Mythic Borogove: Hey.
Indelible Raven: How's it going?
Mythic Borogove: Pretty good, how are you?
Indelible Raven: I'm doing alright, it's the weekend finally, so.
Mythic Borogove: Yeah.
...
Indelible Raven: Cool. That works then.
...
Mythic Borogove: I guess, just out of curiosity, what do you get out of doing Interviewing.io as an interviewer?
Indelible Raven: ... Giving back to the next class of software engineers...
Mythic Borogove: Yeah, that'd be great.

Images:

Code Example

# Function to calculate distance between points
def get_distance(point1, point2):
    return ((point1[0] - point2[0]) ** 2 + (point1[1] - point2[1]) ** 2) ** 0.5

Conclusion

Overall, the interview was productive, with emphasis on understanding algorithms and optimizations in the context of interviews.