Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 476 Bytes

Question_717.md

File metadata and controls

23 lines (20 loc) · 476 Bytes

LeetCode Records - Question 717 1-bit and 2-bit Characters

Attempt 1:

class Solution {
    public boolean isOneBitCharacter(int[] bits) {
        int i = 0;
        while (i < bits.length - 1) {
            if (bits[i] == 0) {
                i++;
            } else {
                i += 2;
            }
        }

        return i == bits.length - 1;
    }
}
  • Runtime: 0 ms (Beats: 100.00%)
  • Memory: 42.48 MB (Beats: 55.96%)