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

Commitfaca7d0

Browse files
add 2283
1 parent106fa12 commitfaca7d0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-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+
| 2283|[Check if Number Has Equal Digit Count and Digit Value](https://leetcode.com/problems/check-if-number-has-equal-digit-count-and-digit-value/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2283.java)|| Easy||
1112
| 2279|[Maximum Bags With Full Capacity of Rocks](https://leetcode.com/problems/maximum-bags-with-full-capacity-of-rocks/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2279.java)|| Medium||
1213
| 2278|[Percentage of Letter in String](https://leetcode.com/problems/percentage-of-letter-in-string/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2278.java)|| Easy||
1314
| 2270|[Number of Ways to Split Array](https://leetcode.com/problems/number-of-ways-to-split-array/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2270.java)|| Medium||
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
packagecom.fishercoder.solutions;
2+
3+
importjava.util.HashMap;
4+
importjava.util.Map;
5+
6+
publicclass_2283 {
7+
publicstaticclassSolution1 {
8+
publicbooleandigitCount(Stringnum) {
9+
Map<Integer,Integer>map =newHashMap<>();
10+
for (charc :num.toCharArray()) {
11+
intn =Character.getNumericValue(c);
12+
map.put(n,map.getOrDefault(n,0) +1);
13+
}
14+
for (inti =0;i <num.length();i++) {
15+
intn =Character.getNumericValue(num.charAt(i));
16+
inttimes =map.getOrDefault(i,0);
17+
if (n !=times) {
18+
returnfalse;
19+
}
20+
}
21+
returntrue;
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp