Skip to content

Commit 6f427ea

Browse files
committed
Adding Accepted Solution - Problem - 22 - Single Number II
1 parent e844cc6 commit 6f427ea

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
##==================================
2+
## Leetcode June Challenge
3+
## Username: Vanditg
4+
## Year: 2020
5+
## Problem: 22
6+
## Problem Name: Single Number II
7+
##===================================
8+
#
9+
#Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
10+
#
11+
#Note:
12+
#
13+
#Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
14+
#
15+
#Example 1:
16+
#
17+
#Input: [2,2,3,2]
18+
#Output: 3
19+
#Example 2:
20+
#
21+
#Input: [0,1,0,1,0,1,99]
22+
#Output: 99
23+
class Solution:
24+
def singleNumber(self, nums):
25+
return "".join(map(str, [item for item, count in collections.Counter(nums).items() if count == 1]))

0 commit comments

Comments
 (0)