Skip to content

Commit b7baf91

Browse files
refactor 954
1 parent 9d4efd0 commit b7baf91

File tree

1 file changed

+3
-2
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-2
lines changed

src/main/java/com/fishercoder/solutions/_954.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
/**
88
* 954. Array of Doubled Pairs
99
*
10-
* Given an array of integers A with even length, return true if and only if it is possible to reorder it such that A[2 * i + 1] = 2 * A[2 * i] for every 0 <= i < len(A) / 2.
10+
* Given an array of integers A with even length, return true if and only if it is possible to reorder it
11+
* such that A[2 * i + 1] = 2 * A[2 * i] for every 0 <= i < len(A) / 2.
1112
*
1213
* Example 1:
1314
* Input: [3,1,3,6]
@@ -52,7 +53,7 @@ public boolean canReorderDoubled(int[] A) {
5253
continue;
5354
} else {
5455
int count = map.get(num);
55-
map.put(num, map.get(num) - count);
56+
map.put(num, 0);
5657
int doubleNum = num * 2;
5758
if (!map.containsKey(doubleNum)) {
5859
return false;

0 commit comments

Comments
 (0)