Facebook phone interview. [Reject]
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-01-31Added By Anonymous
Source: Link
Company: Meta
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Was underprepared with just under 2 (irregular) months on leet.
Given a list of cartesian co-ordinates find if any 4 of them make a rectangle.
I came up with a brute force approach:
1. Group points in combinations of 4.
2. calculate all possible distances between them.
3. The distances should only have 3 distinct values - 2 sides & diagonal.
(2 distinct values would make it a square).
Felt quite clever that I came up with this, but did not have enough time to code up the solution.
I feel quite inspired by this, despite the rejection.
Would love to hear of any of you leeters have a better solution.