Facebook | Phone screen | Design HashMap

Current job: Member of technical stuff at VMware
Interview company: Facebook
Date: May 18, 2019

Talked about resume and experience a little bit, then coding questions.

  1. Warm up question, how to find a index with equal left and right sum. [1,2,3,2,1], you need to return the index of element 3.
  2. Asked about hashmap design. Design on your own. What if the input 99% will be between 0-100, how do you optmize? I didn't answer well.

First question was easy, I just provided leftSum array and right sum array, and then loop again.
Second one i gave similar answer as the one in book "Algorithmn", talked about to do solve conflict, more importantly how to handle delete effiecnently. But i am not sure how to answer the 99% between 0-100, maybe you can save space somehow?

Comments (4)