Implement Prefix Search and Node Removal
AnsysSoftware Engineer · Technical ScreenLast updated
This question evaluates proficiency in string data structures and manipulation (prefix-search concepts including case-insensitive matching and regex-based normalization) as well as linked list pointer manipulation and in-place node removal.
This interview included two coding tasks:
- Implement a prefix-search data structure for strings with two operations:
insert(word)andcount_with_prefix(prefix). A follow-up asks how to make matching case-insensitive and how to normalize inputs by removing trailing digits with a regular expression before storing or querying. - Given the head of a singly linked list and a target value
x, remove every node whose value equalsxand return the new head.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.