Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9d648a9

Browse files
add 2206
1 parent 7acc434 commit 9d648a9

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ _If you like this project, please leave me a star._ ★
1010
|------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-------------|-------------
1111
| 2210 |[Count Hills and Valleys in an Array](https://leetcode.com/problems/count-hills-and-valleys-in-an-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2210.java) || Easy ||
1212
| 2208 |[Minimum Operations to Halve Array Sum](https://leetcode.com/problems/minimum-operations-to-halve-array-sum/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2208.java) || Medium ||
13+
| 2206 |[Divide Array Into Equal Pairs](https://leetcode.com/problems/divide-array-into-equal-pairs/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2206.java) || Easy ||
1314
| 2201 |[Count Artifacts That Can Be Extracted](https://leetcode.com/problems/count-artifacts-that-can-be-extracted/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2201.java) || Medium ||
1415
| 2200 |[Find All K-Distant Indices in an Array](https://leetcode.com/problems/find-all-k-distant-indices-in-an-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2200.java) || Easy ||
1516
| 2194 |[Cells in a Range on an Excel Sheet](https://leetcode.com/problems/cells-in-a-range-on-an-excel-sheet/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2194.java) || Easy ||
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
public class _2206 {
7+
public static class Solution1 {
8+
public boolean divideArray(int[] nums) {
9+
Map<Integer, Integer> map = new HashMap<>();
10+
for (int num : nums) {
11+
map.put(num, map.getOrDefault(num, 0) + 1);
12+
}
13+
for (int key : map.keySet()) {
14+
if (map.get(key) % 2 != 0) {
15+
return false;
16+
}
17+
}
18+
return true;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)