Files
LeetCode-Go/leetcode/0717.1-bit-and-2-bit-Characters/717. 1-bit and 2-bit Characters.go
2020-08-07 17:06:53 +08:00

12 lines
167 B
Go

package leetcode
func isOneBitCharacter(bits []int) bool {
var i int
for i = 0; i < len(bits)-1; i++ {
if bits[i] == 1 {
i++
}
}
return i == len(bits)-1
}