第一轮: 30 min Behavioral + 10 min Coding + 5 min Q’s to interviewers
print 2D array diagonals
variation of https://leetcode.com/problems/diagonal-traverse/
- ran out of time (I think they gave me 5, instead of 10 min for this) when writing on whiteboard
- was not allowed to finish, but switched to ask questions instead
第二轮: 40 min Coding + 5 min Q’s to interviewers
-
warm up (10 min): reverseSubarray(int[] arr, int first_k_elts)
extension of: https://leetcode.com/problems/reverse-string/ - core challenge (30 min): sort using the function from 1. i.e. implement reverseBasedSort()
- only did it after a hint from the interviewer
第三轮: 40 min 系统设计 + 5 min Q’s to interviewer
Design type-ahead suggestions
- missed that this should be done using trie / suffix tree/ suffix array - so that was it by then
第四轮: 40 min Coding + 5 min Q’s to interviewers
- warm up (10 min): calculate tax from brackets
Calculate tax if Salary and Tax Brackets are given as list in the form
[ [10000, 0.1],[20000, 0.2], [10000, 0.3], [null, .4]]
null being rest of the salary
Big O for both questions
-
core challenge (30 min): print tree column-wise
https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/
Sort and print is O(N logN)
Can you do it in O(N) if you don’t need to sort elements that fall into the same row/column, but put them in the order of traversal?
- I think I got it but was running really low on time towards the end