Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 1.14 KB

_1550. Three Consecutive Odds.md

File metadata and controls

50 lines (38 loc) · 1.14 KB

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : July 01, 2024

Last updated : July 01, 2024


Related Topics : Array

Acceptance Rate : 68.524 %


Solutions

Python

class Solution:
    def threeConsecutiveOdds(self, arr: List[int]) -> bool:
        for i in range(2, len(arr)) :
            if arr[i] % 2 == arr[i - 1] % 2 == arr[i - 2] % 2 == 1 :
                return True
            
        return False

C

bool threeConsecutiveOdds(int* arr, int arrSize) {
    for (int i = 2; i < arrSize; i++) {
        if (arr[i] % 2 == arr[i - 1] % 2 && 
            arr[i - 1] % 2 == arr[i - 2] % 2 && 
            arr[i - 2] % 2 == 1)
            return true;
    }
    return false;
}