Facebook | Phone | Integer to English Words & Reservoir Sampling

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-04-14Added By Anonymous
Source: Link

Company: Meta
Role: e3
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Position: Enterprise Engineer New Grad
Just completed my Phone screen.

Question 1:
https://leetcode.com/problems/integer-to-english-words/

Did this in 30 mins and then he asked to show approach for second question:

Question 2:
Given an array of integers (might duplicate ones) and an int `k`. Randomly pick an array of k integers from this array. (Didn't have to code just show the approach).

I could show this in O(n*k) initially but couldn't solve in O(k) (He asked me to improve the approach). After lot of clues (almost gave me the solution), I could show an approach.

Not sure if I have gone past the interviewer's expectations.

Comments