Write a function parseQuery without using URLSearchParams. It takes a query string, for example question mark, a equals one, ampersand, b equals two, and returns an object with the keys and values. If a key repeats, its values are collected into an array.
~15 min by voice
How to approach it
The interviewer is checking careful string handling and attention to edge cases: the leading "?", repeated keys, a key without a value, "=" inside a value, empty segments and decoding. It also matters whether you clarify the requirements before writing code and check the solution on an example.
The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.