반응형
Hi all, my first ever faang interview and i got 2 problems
- 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. - 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 :)
반응형
'etc' 카테고리의 다른 글
timeseries DB (0) | 2022.10.13 |
---|---|
Arinc 615a data loader (0) | 2022.08.29 |
FB E4 others (0) | 2022.08.21 |
FB interview other case (0) | 2022.08.21 |
EXERCISE9 (0) | 2015.09.01 |