Skip to content

1550. Three Consecutive Odds #285

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

The problem asks us to determine if an array contains three consecutive odd numbers. If such a triplet exists, return true; otherwise, return false.

Key Points

  1. Input: An array of integers (arr) where each element satisfies 1 \leq arr[i] \leq 1000.
  2. Output: A boolean indicating the presence of three consecutive odd numbers.
  3. Core Operation: Checking for odd numbers and consecutive patterns.
  4. Constraints:
    • Array length is at least 1 and at most 1000.

Approach

We need to iterate through the array and check every triplet of consecutive numbers to see if they are all odd. If we find such a triplet, we can immediately return true. If we traverse the entire array without finding one, return false.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jan 26, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants