Google L4 India
Was asked this question
Implement the following functions
registerHandler("/home", "home/new", "/user", "user/{userId}", "/user/{userId}/pictures/{pictureId}") -> adds an api route to the system, the curly braces indicates presence of parameter in the path
getHandler(String path) -> return the associated url present in the system.
getHandler("/home")-> home
getHandler ("/user/101") -> "/user/{userId}"
getHandler("user/101/pictures/101") -> /user/{userId}/pictures/{pictureId}
This is a trie question you are supposed to handle the parameters by keeping a special parameter in the trieNode definition
Verdict: was not able to fully implement it, awaiting a rejection
Honestly need to practice a lot more was able to recognise the approach almost immediately but code had a lot of bugs, Interviewer was super polite and helped throughout the interview.
Hopefully this helps the community.
LC stats: around 913 questions


