add new solutions
This commit is contained in:
parent
ca24d0a56a
commit
0c73608ce5
36 changed files with 791 additions and 0 deletions
17
solutions/7/q717/solution.go
Normal file
17
solutions/7/q717/solution.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package q717
|
||||
|
||||
func isOneBitCharacter(bits []int) bool {
|
||||
if len(bits) == 1 {
|
||||
return true
|
||||
}
|
||||
if bits[len(bits)-2] == 0 {
|
||||
return true
|
||||
}
|
||||
cnt1 := 0
|
||||
for i := len(bits) - 2; i >= 0 && bits[i] == 1; i-- {
|
||||
cnt1++
|
||||
}
|
||||
return cnt1%2 == 0
|
||||
}
|
||||
|
||||
var _ = isOneBitCharacter
|
||||
Loading…
Add table
Add a link
Reference in a new issue