1-bit and 2-bit Characters
A easy-tier problem at 45% community acceptance, tagged with Array. Reported in interviews at Quora and 1 others.
You're in an OA and you see an array of 0s and 1s that represent encoded characters. One character is 1-bit, another is 2-bit. Your job: figure out if the last element is a 1-bit character. Quora and IXL have both asked this. It sounds simple, but most people either overcomplicate it or miss the actual pattern. The acceptance rate sits at 45%, which means roughly half the candidates who attempt it don't nail it cleanly. If this problem shows up live and you blank on the indexing trick, StealthCoder surfaces a solution in seconds, invisible to the proctor.
Companies that ask "1-bit and 2-bit Characters"
1-bit and 2-bit Characters 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 realized the OA tests how well you memorized 200 problems, not how well you code.
Get StealthCoderThe trap is thinking you need to decode the entire array. You don't. The real insight is that you only care whether you can reach the last index as a 1-bit character, not what happens after. A 1-bit character is always 0. A 2-bit character always starts with 1 and is followed by either 0 or 1, consuming two positions. So you iterate forward: if you see a 0, jump by 1; if you see a 1, jump by 2. The trick is the final check: you've hit the end cleanly if your index lands exactly on the last position after processing a 1-bit (0), not in the middle of a 2-bit pair. Most failed submissions either don't handle the boundary correctly or try to decode backwards. When you sit down live and this Array problem lands, that index-hopping pattern is the only thing standing between you and a pass. StealthCoder is the safety net if the indexing logic doesn't click in the moment.
Pattern tags
You know the problem.
Make sure you actually pass it.
1-bit and 2-bit Characters 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 realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.
1-bit and 2-bit Characters interview FAQ
Why is the acceptance rate only 45% on an 'easy' problem?+
The indexing boundary case trips people up. You have to correctly determine whether landing on the last index counts as a valid 1-bit termination or an incomplete 2-bit read. Most submissions either overcomplicate the state machine or mishandle the final check, causing off-by-one errors.
What's the actual trick nobody talks about?+
You don't decode. You jump. Iterate through the array: see a 0, jump 1 position forward; see a 1, jump 2. The final answer hinges on whether your index lands exactly on the last position after processing, not whether you can read beyond it.
Is this still asked at major companies?+
Yes. Quora and IXL have both included it in their assessments. The problem is small but patterns-based, so it shows up regularly in screening rounds where they want to test basic indexing discipline and boundary awareness.
Do I need dynamic programming or greedy here?+
Neither. This is a single-pass iteration problem. You walk the array once, respecting the character width rules (1-bit or 2-bit), and check if you land cleanly on the last index. Array traversal and index arithmetic are all you need.
What mistakes do most people make in the live OA?+
Forgetting to validate that the final index is exactly on the last element, not before or after. Also, miscounting when a 1-bit vs. 2-bit character is being read. The boundary condition is where 50% of submissions fail.
Want the actual problem statement? View "1-bit and 2-bit Characters" on LeetCode →