Ctrl K

Three Odds in a Row

Easy
You are given an integer array values. Determine whether it contains three **adjacent** elements that are all odd. Return true if such a triple exists and false otherwise.
Example 1
values=[4, 9, 15, 2, 7, 11, 21, 8] → True

7, 11 and 21 stand next to each other and are all odd.

Example 2
values=[3, 5, 6, 1, 9] → False

Odd numbers come in pairs (3, 5 and 1, 9), but 6 breaks them up, so there is no run of three.

Constraints
  • 1 ≤ values.length ≤ 1000
  • 1 ≤ values[i] ≤ 1000
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsPair With a Target Sum EasySqueeze Repeats Out of a Sorted Array EasyDrop the Unwanted Value EasySlot on a Sorted Shelf EasyAdd One to a Digit Array Easy
loading Python…
Input
values=[4, 9, 15, 2, 7, 11, 21, 8]
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 123 tests on the server, hidden ones included.