Count the Number of Consistent Strings
A easy-tier problem at 88% community acceptance, tagged with Array, Hash Table, String. Reported in interviews at Robinhood and 0 others.
Count the Number of Consistent Strings is an easy problem that Robinhood has asked. You're given an allowed set of characters and a list of words. A word is consistent if every character in it belongs to the allowed set. Your job is count how many words pass that test. With an acceptance rate above 88%, this looks like a warm-up, but it's the kind of problem where you can write slow code or fast code, and interviewers watch which one you reach for first. If this hits your live OA and you blank on the optimal approach, StealthCoder solves it in seconds, invisible to the proctor.
Companies that ask "Count the Number of Consistent Strings"
Count the Number of Consistent Strings is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.
Get StealthCoderThe trick here isn't algorithmic complexity, it's choosing the right data structure. You could iterate through each word and check each character against the allowed set using a linear search, which works but wastes time. Build a hash table or bit mask from the allowed characters instead, then for each word, check membership in constant time. Bit manipulation is listed as a topic because you can encode the 26 lowercase letters as a single integer bitmask and avoid hashing overhead entirely. Most candidates pick the hash table first and that's fine, but recognizing when bit manipulation speeds things up is where interviews separate fast from slow. StealthCoder is the hedge for the one problem you didn't drill enough to recognize the pattern instantly.
Pattern tags
You know the problem.
Make sure you actually pass it.
Count the Number of Consistent Strings recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Count the Number of Consistent Strings interview FAQ
Is this problem actually easy or a trick?+
It's genuinely easy. The 88% acceptance rate confirms it. The trick is just choosing hash table or bitmask over repeated linear searches. No dynamic programming, no graph traversal, no edge cases that derail you. This is a warm-up problem.
Does Robinhood actually ask this?+
Yes, it's reported as asked by Robinhood. It's the kind of screening problem used to filter out candidates who can't code a simple loop and hash lookup cleanly. Not a signal of deeper round difficulty.
Should I use a hash set or bit mask?+
Hash set is simpler and fast enough. Bit mask is faster and shows you understand low-level optimization. For an easy problem at a company like Robinhood, either is fine. Bit mask gets you extra points if you articulate why it's better.
What's the difference between Array and Hash Table approaches here?+
Array approach: create a boolean array of size 26 (one per letter), mark allowed characters, then check each word. Hash Table: store allowed characters in a set, check membership per character. Both are O(1) per character. Array is slightly faster due to cache locality.
Can I solve this without extra space?+
No, you need to store the allowed character set somehow. You could argue the input itself is your allowed set and iterate it for each word, but that's O(n * m * k) and worse than building a lookup once.
Want the actual problem statement? View "Count the Number of Consistent Strings" on LeetCode →