Skip to content

update 2206 python #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change into counter
  • Loading branch information
ShengyuanWang committed Mar 24, 2022
commit f501b38f4094e0c96639badafb6fd12cd1b582f7
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ The first step is to count the number of times each number appears in the array.
```python
class Solution:
def divideArray(self, nums: List[int]) -> bool:
dic = {}
for num in nums:
if num in dic:
dic[num] += 1
else:
dic[num] = 1
dic = Counter(nums)
for num in dic:
if dic[num] % 2 != 0:
return False
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
class Solution:
def divideArray(self, nums: List[int]) -> bool:
dic = {}
for num in nums:
if num in dic:
dic[num] += 1
else:
dic[num] = 1
dic = Counter(nums)
for num in dic:
if dic[num] % 2 != 0:
return False
Expand Down