Facebook | Phone screen | Design HashMap

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2019-05-24Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e3, e4
Interview Stage: Phone Screen
Location: unknown
Year: 2019

Original Post Content:

Current job: Member of Technical Staff 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 an 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 optimize? 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 a similar answer as the one in book "Algorithm", talked about how to solve conflict, more importantly how to handle delete efficiently. But I am not sure how to answer the 99% between 0-100, maybe you can save space somehow?

Comments