Implement Prefix Search and Node Removal
Company: Ansys
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: 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.
Prefix Search Trie
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([[ 'insert','apple'],['insert','app'],['count','app'],['count','appl']], False)
Expected Output: [2, 1]
Explanation: Prefix counts after inserts.
Input: ([[ 'insert','Test123'],['count','test']], True)
Expected Output: [1]
Explanation: Normalization lowercases and removes trailing digits.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.
Remove Target Nodes From Linked List
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([1,2,6,3,6], 6)
Expected Output: [1, 2, 3]
Explanation: Remove all target values.
Input: ([], 1)
Expected Output: []
Explanation: Empty list unchanged.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.