第⼀轮电⾯的题⽬是设计⼀个weighted random sampler class,并且实现⼀个method叫sample. ⾯试官解释说⼀个sampler可以由多个Tuple组成。举个例⼦就是[(‘a’, 0.3), (‘b’, 0.5), (‘c’, 0.4)]. 意思就是说这个sampler由这三个tuple组成,'a’那个tuple占比30%,'b’那个tuple占⽐50%- 'c’那个tuple占⽐40%。每个tuple包含⼀个character和这个tuple的weight。每个sampler也可以由更多个tuple组成。sample method ⾥写的就是随机产⽣⼀个percentage, 然后return 这个percentage对应的character.
对代码的要求是runnable,⾃⼰写unit tests, 思路解释清楚,⾯试官要看懂每⾏代码,看不懂的时候他就会问。没说⼀定要bug free
⾯试官⽐较懂python,他说如果⽤java写,tuple就是array,每个sampler由a List of arrays组成。

Hi all,
Got reached out by an Uber recruiter on LinkedIn so wanted to share my experience. By then, I had solved around 50 questions. 40 Easy, 9 Medium and 1 Hard.

I had my first Technical Phone Screen with an Engineer with a problem similar to 'LRU Cache ’ on Leetcode, but with more variations and difficulties along the way. It was also presented in a very generic manner so there were alot of questions I asked along the way. I felt that I communicated very properly and the feedback was that I even had the right algorithm but because I ran out of time (40 minutes), I could not implement the full code.

Then, the recruiter was nice enough to take the feedback with a grain of salt and allowed me a second opportunity for a Technical Phone Screen. The second round went better than the first. It was the ’ Finding the number of Islands in a Matrix of 1’s and 0’s '. I was able to slowly communicate and code my way fully to the solution. I got stuck on some small parts of the DFS algorithm but was able to compile. However, since this was on Hackerrank the interviewer asked me to compile but my output wasnt correct. I tried several options to change the code but wouldnt get the exact output so there was some error in my logic. Unfortunately, time had run out. The Engineer even said “we are very close” but the time was out.
Then, a week later they rejected.

I was really bummed because I did much better than my first round and thought I’d get called for onsight. Do big firms expect fully working code? I thought I had all other aspects in the interview right, but seems that this was the deciding factor? Even when practicing on leetcode, i struggle to get a perfectly working solution in time. This really upsets me.
How can I leverage my skills sharper to complete the problem perfectly in time? I still feel I struggle alot and sometimes i dont, but thats rare. How many problems do I need to solve to get better and how to I become much better than I am now? I stuggle with DP, recursion, and non-linear DS in particular.