Skip to content

Commit ebd553f

Browse files
add 3046
1 parent 7a3b8ef commit ebd553f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Diff for: README.md

+1
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+
| 3046 |[Split the Array](https://leetcode.com/problems/split-the-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3046.java) | | Easy |
1112
| 3042 |[Count Prefix and Suffix Pairs I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3042.java) | | Easy |
1213
| 3038 |[Maximum Number of Operations With the Same Score I](https://leetcode.com/problems/maximum-number-of-operations-with-the-same-score-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3038.java) | | Easy |
1314
| 3006 |[Find Beautiful Indices in the Given Array I](https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3006.java) | | Medium |

Diff for: src/main/java/com/fishercoder/solutions/_3046.java

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.fishercoder.solutions;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
public class _3046 {
7+
public static class Solution1 {
8+
public boolean isPossibleToSplit(int[] nums) {
9+
Map<Integer, Integer> map = new HashMap<>();
10+
for (int num : nums) {
11+
map.put(num, map.getOrDefault(num, 0) + 1);
12+
if (map.get(num) > 2) {
13+
return false;
14+
}
15+
}
16+
return true;
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)