We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb16935 commit 9b67fb0Copy full SHA for 9b67fb0
3046.Split-the-Array.java
@@ -0,0 +1,27 @@
1
+// https://leetcode.com/problems/split-the-array/description/
2
+// algorithms
3
+// Easy (56.7%)
4
+// Total Accepted: 35.5K
5
+// Total Submissions: 62.7K
6
+
7
8
+class Solution {
9
10
+ public boolean isPossibleToSplit(int[] nums) {
11
+ Map<Integer, Integer> map = new HashMap<>();
12
13
+ for (int n : nums) {
14
+ Integer curTime = map.get(n);
15
+ if (curTime == null) {
16
+ map.put(n, 1);
17
+ } else if (curTime >= 2) {
18
+ return false;
19
+ } else {
20
+ map.put(n, curTime + 1);
21
+ }
22
23
24
+ return true;
25
26
27
+}
0 commit comments