Phone Screen
Questions: Implement a string replacement object that supports:
store(key: str, value: str) -> None
; stores a certainvalue
askey
convert(input: str) -> str
; convert an input string that utilizes a previously storedkey
- i.e., if we have already made a call of
store(key="USER", value="leetcoder22")
, thenconvert("username is $USER$")
should return"username is leetcoder22"
.
- i.e., if we have already made a call of
- Follow-up: What if we want to include
"$"
as part of a key?
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Onsite 1
Questions:
In a game, player 1 picks a five-letter secret
word with no duplicates and player 2 tries to guess it. For every guess, player 1 scores the guess out of 5, indicating how many letters exist within the secret
word.
- Implement
score(secret: str, guess: str) -> int
; return the score player 1 gives player 2; i.e.,score("teams", "abide")
returns2
. - Implement
is_possible_guess(hist: typing.Any, guess: str)
; given previous guessing history and their scores, see if the next guess is a reasonable next guess. - Implement
next_guess(hist: typing.Any) -> str
; given previously guessed words and their scores, what should player 2 guess?
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Onsite 2
Questions: Given a word indicating the ordering of a foreign alphabet, examine if an input string is sorted in that order.
- i.e.,
is_ordered(order="abcd", input="aaaboid")
returnsTrue
.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Onsite 3
Questions: Implement a restaurant waiting list system that supports:
- Given a party size, put the party in the waitlist, return a party id.
- Given party id, remove party from the waitlist.
- Given a party size, get the next waiting party of that size, return party id.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.