1-bit and 2-bit Characters Problem
1-bit and 2-bit Characters Problem — ExecCode Easy DSA Practice
Solve the 1-bit and 2-bit Characters problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description We have two special characters:. Your task is to given a binary array bits that ends with 0, return true if the last character must be a one-bit character. The first character can be represented by one bit 0. - The second character can be represented by two bits (10 or 11).
Examples
Input {"bits": [1, 0, 0]}; Output True. Input {"bits": [1, 1, 1, 0]}; Output False
Constraints
1 <= bits.length <= 1000 bits[i] is either 0 or 1.
Practice 1-bit and 2-bit Characters free on ExecCode. Browse DSA problems, topic map, and placement guides.