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

Commit f7388da

Browse files
authored
Update Day-11_Array of Doubled Pairs.py
1 parent b9a9f46 commit f7388da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎Leetcode_30day_challenge/August_Challenge_2021/Day-11_Array of Doubled Pairs.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ def canReorderDoubled(self, arr: List[int]) -> bool:
66

77
for i in arr:
88
double = 2*i
9+
# Since we have sorted the array, we'll first iterate over the small values and if small values frequency is zero, we just continue
910
if d[i] == 0:
1011
continue
12+
# If double values frequency is Zero, that means there is no double value for i. So we return False
1113
if d[double] == 0:
1214
return False
15+
# Decrement both i and double
1316
d[double] -= 1
1417
d[i] -= 1
1518

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /