PracHub
QuestionsCodingPremiumCoachesLearningGuidesInterview Prep

Quick Overview

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.

  • medium
  • Ansys
  • Coding & Algorithms
  • Software Engineer

Implement Prefix Search and Node Removal

Company: Ansys

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

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.

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

Process insert and count operations on a trie, with optional lowercase/trailing-digit normalization.

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

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.

Remove Target Nodes From Linked List

Linked lists are represented as value arrays. Return the values after removing every node equal to x.

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

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.