Facebook | E5 | phone screen

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-06-05Added By Anonymous
Source: Link

Company: Meta
Role: E5
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Hi all, my first ever faang interview and I got 2 problems

1) Check if the array of length N is a permutation of N
example: [0,1,3,4,2] -> True ; [0,1,2,5] -> False; [0,3,3] -> False; [-1,-2,0,1] -> False
I have solved it using adding numbers from array to set and checking if numbers in range of N are in set, if not return False else True.
Was asked if we can improve on a space complexity, suggested sorting (NlogN) but he said can we do linear time not using extra space. I've tanked for 1-2 mins and we moved to another question.

2) return level of maximum sum of a binary tree without the minimum level constraint ( https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/ )
Did DFS solution, ran out of time to implement actually returning the level, but the interviewer said he got my logic and its correct.

All in all, expecting a reject since my 1st solution was sub-optimal and could not finish 2nd question within a time given. But I am super happy that I was able to solve this problems on an actual interview, because few months ago I was not able to solve 99% of the problems and during interview I actually managed to explain and implement things. Definitely a great learning experience and I hope next time I will nail it :)

Comments