티스토리 뷰

etc

FB E5 phone interview

shannon. 2022. 8. 21. 14:26
반응형

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 :)

반응형

'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
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함