Katkat

Return dictionary words matching a prefix

GoogleSoftware Engineer · Technical Screen

Last updated

This problem evaluates string-processing and filtering skills, focusing on exact prefix matching, case sensitivity, duplicate handling, and edge-case management over arrays of strings. Commonly asked in Coding & Algorithms interviews, it assesses practical implementation ability and understanding of algorithmic complexity at an implementation-level (basic to intermediate).

You are given a list of strings words (a dictionary) and a string prefix.

Return all words in words that start with prefix.

Clarifications/constraints:

  • Matching is case-sensitive.
  • If no words match, return an empty list.
  • If words contains duplicates, include duplicates in the output.
  • You may return the result in any order unless the interviewer asks for a specific ordering (e.g., lexicographic).