go: add «1550. Three Consecutive Odds»
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
5bb1c156a4
commit
1a015c14b4
1 changed files with 11 additions and 0 deletions
11
go/three-consecutive-odds.go
Normal file
11
go/three-consecutive-odds.go
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
func threeConsecutiveOdds(arr []int) bool {
|
||||||
|
for i := 0; i+2 < len(arr); i++ {
|
||||||
|
if arr[i]&arr[i+1]&arr[i+2]&1 != 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
Loading…
Reference in a new issue