The Count the Number of Special Characters I coding problem asks you to count how many "special" characters exist in a string. A character is considered special if both its lowercase and uppercase versions appear at least once in the given string.
For example, in "abAb", 'a' is special (both 'a' and 'A' exist) and 'b' is special (both 'b' and 'B' exist).
This is a standard "Easy" problem used by Amazon and Google to test basic hash table interview pattern or frequency counting skills. It evaluates if a candidate can correctly map characters to their counterparts and avoid double-counting. It also checks for clean string processing and set manipulation.
This problem uses Frequency Counting (Hash Set).
lower_seen and upper_seen.lower_seen.upper_seen.c exists in both lower_seen and upper_seen, increment the result.s = "aaAbc"
lower: {a, b, c}upper: {A}char - 'a' for index 0-25).For character counting, always ask yourself if the input is ASCII or Unicode. If it's just English letters, a fixed-size array bool[26] is often more efficient and cleaner than a Set or Map.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Path Crossing | Easy | Solve | |
| Rings and Rods | Easy | Solve | |
| Single-Row Keyboard | Easy | Solve | |
| Check if the Sentence Is Pangram | Easy | Solve | |
| Buddy Strings | Easy | Solve |