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:false
Explanation:

No 3 consecutive odds.

Input:arr = [1,2,34,3,4,5,7,23,12]
Output:true
Explanation:

Three consecutive odd numbers exist: 5, 7, 23 at indices 5, 6, 7.

Input:arr = [1,3,5]
Output:true
Explanation:

The entire array consists of exactly 3 consecutive odd numbers: 1, 3, and 5.

Constraints

  • 1 ≤ arr.length ≤ 1000

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!