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

Commit0f6dce4

Browse files
add 1822
1 parentdc29c0f commit0f6dce4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-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+
|1822|[Sign of the Product of an Array](https://leetcode.com/problems/sign-of-the-product-of-an-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1822.java)||Easy|Math|
1112
|1817|[Finding the Users Active Minutes](https://leetcode.com/problems/finding-the-users-active-minutes/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1817.java)||Medium|HashTable|
1213
|1816|[Truncate Sentence](https://leetcode.com/problems/truncate-sentence/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1816.java)||Easy|String|
1314
|1814|[Count Nice Pairs in an Array](https://leetcode.com/problems/count-nice-pairs-in-an-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1814.java)||Medium|Array, HashTable|
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1822 {
4+
publicstaticclassSolution1 {
5+
publicintarraySign(int[]nums) {
6+
intnegativeCount =0;
7+
for (intnum :nums) {
8+
if (num ==0) {
9+
return0;
10+
}elseif (num <0) {
11+
negativeCount++;
12+
}
13+
}
14+
returnnegativeCount %2 ==0 ?1 : -1;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp