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

Commit1af29b4

Browse files
add 3063
1 parente4fe2a0 commit1af29b4

File tree

2 files changed

+26
-0
lines changed
  • paginated_contents/algorithms/4th_thousand
  • src/main/java/com/fishercoder/solutions/fourththousand

2 files changed

+26
-0
lines changed

‎paginated_contents/algorithms/4th_thousand/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
| 3074|[Apple Redistribution into Boxes](https://leetcode.com/problems/apple-redistribution-into-boxes/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3074.java)|| Easy|
5757
| 3069|[Distribute Elements Into Two Arrays I](https://leetcode.com/problems/distribute-elements-into-two-arrays-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3069.java)|| Easy|
5858
| 3065|[Minimum Operations to Exceed Threshold Value I](https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3065.java)|| Easy|
59+
| 3063|[Linked List Frequency](https://leetcode.com/problems/linked-list-frequency/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3063.java)|| Easy|
5960
| 3062|[Winner of the Linked List Game](https://leetcode.com/problems/winner-of-the-linked-list-game/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3062.java)|| Easy|
6061
| 3046|[Split the Array](https://leetcode.com/problems/split-the-array/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3046.java)|| Easy|
6162
| 3042|[Count Prefix and Suffix Pairs I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/)|[Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3042.java)|| Easy|
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
packagecom.fishercoder.solutions.fourththousand;
2+
3+
importcom.fishercoder.common.classes.ListNode;
4+
5+
importjava.util.HashMap;
6+
importjava.util.Map;
7+
8+
publicclass_3063 {
9+
publicstaticclassSolution1 {
10+
publicListNodefrequenciesOfElements(ListNodehead) {
11+
Map<Integer,Integer>map =newHashMap<>();
12+
while (head !=null) {
13+
map.put(head.val,map.getOrDefault(head.val,0) +1);
14+
head =head.next;
15+
}
16+
ListNodepre =newListNode(-1);
17+
ListNodetmp =pre;
18+
for (Map.Entry<Integer,Integer>entry :map.entrySet()) {
19+
tmp.next =newListNode(entry.getValue());
20+
tmp =tmp.next;
21+
}
22+
returnpre.next;
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp