Description
Given an integer array arr, return true if there are three consecutive odd numbers in the array. Otherwise, return false.
Examples
Input:
arr = [2,6,4,1]Output:
falseExplanation:
No 3 consecutive odds.
Input:
arr = [1,2,34,3,4,5,7,23,12]Output:
trueExplanation:
Three consecutive odd numbers exist: 5, 7, 23 at indices 5, 6, 7.
Input:
arr = [1,3,5]Output:
trueExplanation:
The entire array consists of exactly 3 consecutive odd numbers: 1, 3, and 5.
Constraints
- •
1 ≤ arr.length ≤ 1000