Skip to content

Practice 1-bit and 2-bit Characters

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#717
LeetCode Problem

1-bit and 2-bit Characters

Problem Statement

A one-bit character is encoded as 0. A two-bit character is encoded as either 10 or 11. Given a binary array bits ending in 0, decode it from left to right and return whether its final character must use the one-bit encoding.

Source: 1-bit and 2-bit Characters on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
bits = [1,0,0]
Output
true

# Example 2

Input
bits = [1,1,1,0]
Output
false

Constraints

1 <= bits.length <= 1000
bits[i] is either 0 or 1.

Related LeetCode Problems

Practice more problems similar to 1-bit and 2-bit Characters.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.