Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2bcffee

Browse files
add 1550
1 parent2e72b3d commit2bcffee

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1550|[Three Consecutive Odds](https://leetcode.com/problems/three-consecutive-odds/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1550.java)||Easy|Array|
1112
|1545|[Find Kth Bit in Nth Binary String](https://leetcode.com/problems/find-kth-bit-in-nth-binary-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1545.java)||Medium|String|
1213
|1544|[Make The String Great](https://leetcode.com/problems/make-the-string-great/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1544.java)||Easy|String, Stack|
1314
|1541|[Minimum Insertions to Balance a Parentheses String](https://leetcode.com/problems/minimum-insertions-to-balance-a-parentheses-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1541.java)||Medium|String, Stack|
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1550 {
4+
publicstaticclassSolution1 {
5+
publicbooleanthreeConsecutiveOdds(int[]arr) {
6+
for (inti =0;i <arr.length -2;i++) {
7+
if (arr[i] %2 ==1 &&arr[i +1] %2 ==1 &&arr[i +2] %2 ==1) {
8+
returntrue;
9+
}
10+
}
11+
returnfalse;
12+
}
13+
}
14+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
packagecom.fishercoder;
2+
3+
importcom.fishercoder.solutions._1550;
4+
importorg.junit.BeforeClass;
5+
importorg.junit.Test;
6+
7+
importstaticjunit.framework.TestCase.assertEquals;
8+
9+
publicclass_1550Test {
10+
privatestatic_1550.Solution1solution1;
11+
privatestaticint[]arr;
12+
13+
@BeforeClass
14+
publicstaticvoidsetup() {
15+
solution1 =new_1550.Solution1();
16+
}
17+
18+
@Test
19+
publicvoidtest1() {
20+
arr =newint[]{2,6,4,1};
21+
assertEquals(false,solution1.threeConsecutiveOdds(arr));
22+
}
23+
24+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp