Design Skiplist
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Implement a **skiplist**: a stack of sorted linked lists where every level is a sparser "express lane" over the level below, letting search skip most elements. Do not use any built-in sorted container or library.
- Skiplist() creates an empty skiplist.
- search(target) returns true if target is present, otherwise false.
- add(num) inserts num. Duplicates are allowed; each add stores one more copy.
- erase(num) removes **one** copy of num and returns true, or returns false if num is not present.
Each operation should run in expected O(log n). The grader only checks the returned values, so any internal random level choice is acceptable.
Examples
Constraints
- 0 <= num, target <= 2 * 10^4
- At most 5 * 10^4 calls are made to `search`, `add` and `erase`.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.