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

Commit1be6ce0

Browse files
add 1941
1 parentba7dbba commit1be6ce0

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-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 1
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1941|[Check if All Characters Have Equal Number of Occurrences](https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1941.java)||Easy||
1112
|1936|[Add Minimum Number of Rungs](https://leetcode.com/problems/add-minimum-number-of-rungs/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1936.java)||Medium||
1213
|1935|[Maximum Number of Words You Can Type](https://leetcode.com/problems/maximum-number-of-words-you-can-type/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1935.java)||Easy|String|
1314
|1929|[Concatenation of Array](https://leetcode.com/problems/concatenation-of-array/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1929.java)||Easy||
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
packagecom.fishercoder.solutions;
2+
3+
importjava.util.HashSet;
4+
importjava.util.Set;
5+
6+
publicclass_1941 {
7+
publicstaticclassSolution {
8+
publicbooleanareOccurrencesEqual(Strings) {
9+
int[]counts =newint[26];
10+
for (charc :s.toCharArray()) {
11+
counts[c -'a']++;
12+
}
13+
Set<Integer>set =newHashSet<>();
14+
for (inti :counts) {
15+
if (i !=0) {
16+
set.add(i);
17+
}
18+
}
19+
returnset.size() ==1;
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp