Skip to content

Commit d547296

Browse files
committed
Get three consecutive numbers and check if they are odd
1 parent 8770f30 commit d547296

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

1550/main.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
impl Solution {
2+
pub fn three_consecutive_odds(arr: Vec<i32>) -> bool {
3+
for item in 0..arr.len() {
4+
if item+2 < arr.len() {
5+
if arr[item] % 2 != 0 && arr[item+1] %2 != 0 && arr[item+2] %2 !=0 {
6+
return true;
7+
}
8+
}
9+
}
10+
false
11+
12+
}
13+
}

0 commit comments

Comments
 (0)