i
to 0
.i
until i
reaches the length of the array minus 1.bits[i]
is 0
, increment i
by 1
(one-bit character).bits[i]
is 1
, increment i
by 2
(two-bit character).i
is exactly at the last index (length of the array minus 1).i
is at the last index, return true
. Otherwise, return false
.