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

Commita087125

Browse files
add 2980
1 parent0629e9f commita087125

File tree

2 files changed

+22
-1
lines changed
  • paginated_contents/algorithms/3rd_thousand
  • src/main/java/com/fishercoder/solutions/thirdthousand

2 files changed

+22
-1
lines changed

‎paginated_contents/algorithms/3rd_thousand/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
| # | Title | Solutions | Video | Difficulty | Tag
22
|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|------------------------------------------|----------------------------------------------------------------------
3-
| 2996|[Smallest Missing Integer Greater Than Sequential Prefix Sum](https://leetcode.com/problems/smallest-missing-integer-greater-than-sequential-prefix-sum/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2996.java)|| Easy|
3+
| 2996|[Smallest Missing Integer Greater Than Sequential Prefix Sum](https://leetcode.com/problems/smallest-missing-integer-greater-than-sequential-prefix-sum/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2996.java)|| Easy|
4+
| 2980 |[Check if Bitwise OR Has Trailing Zeros](https://leetcode.com/problems/check-if-bitwise-or-has-trailing-zeros/) |[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2980.java) | | Easy | Bit Manipulation
45
| 2976 |[Minimum Cost to Convert String I](https://leetcode.com/problems/minimum-cost-to-convert-string-i/) |[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2976.java) | | Medium | Graph, Shortest Path
56
| 2974|[Minimum Number Game](https://leetcode.com/problems/minimum-number-game/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2974.java)|| Easy|
67
| 2970|[Count the Number of Incremovable Subarrays I](https://leetcode.com/problems/count-the-number-of-incremovable-subarrays-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2970.java)|| Easy|
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
packagecom.fishercoder.solutions.thirdthousand;
2+
3+
publicclass_2980 {
4+
publicstaticclassSolution1 {
5+
/**
6+
* 1. bitwise OR can never unset a bit, so if the solution exists, there must be a pair of elements;
7+
* 2. as the rightmost bit must stay unset, it's essentially looking for a pair of two even numbers.
8+
*/
9+
publicbooleanhasTrailingZeros(int[]nums) {
10+
for (inti =0;i <nums.length;i++) {
11+
for (intj =i +1;j <nums.length;j++) {
12+
if (nums[i] %2 ==0 &&nums[j] %2 ==0) {
13+
returntrue;
14+
}
15+
}
16+
}
17+
returnfalse;
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp