The Kth Distinct String in an Array interview question asks you to find the string in a list that appears exactly once. A string is "distinct" if its frequency in the entire array is 1. You should return the string that occupies the position among all distinct strings, in the order they appear in the original array.
Companies like Amazon and Bloomberg use this as a basic assessment of Hash Table interview patterns. It evaluations whether you can distinguish between "all unique elements" and "elements with a frequency of 1." It tests your ability to perform a two-pass linear scan efficiently.
This problem follows the Frequency Counting pattern.
arr = ["a", "b", "a", "c", "c", "d"], k = 2
a: 2, b: 1, c: 2, d: 1.Always look for the "order of appearance" requirement. If it's required, you must either do a second pass over the original array or use an Ordered Hash Map (like LinkedHashMap in Java) to preserve insertion order.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Most Common Word | Easy | Solve | |
| Find Words That Can Be Formed by Characters | Easy | Solve | |
| Count Common Words With One Occurrence | Easy | Solve | |
| Sender With Largest Word Count | Medium | Solve | |
| Subdomain Visit Count | Medium | Solve |