Katkat

Implement Prefix Search and Node Removal

AnsysSoftware Engineer · Technical Screen

Last 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:

  1. Implement a prefix-search data structure for strings with two operations: insert(word) and count_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.
  2. Given the head of a singly linked list and a target value x, remove every node whose value equals x and return the new head.