File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ ##==================================
2+ ## Leetcode
3+ ## Student: Vandit Jyotindra Gajjar
4+ ## Year: 2020
5+ ## Problem: 287
6+ ## Problem Name: Find the Duplicate Number
7+ ##===================================
8+ #
9+ #Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive),
10+ #prove that at least one duplicate number must exist. Assume that there is only one duplicate number,
11+ #find the duplicate one.
12+ #
13+ #Example 1:
14+ #
15+ #Input: [1,3,4,2,2]
16+ #Output: 2
17+ #Example 2:
18+ #
19+ #Input: [3,1,3,4,2]
20+ #Output: 3
21+ class Solution :
22+ def findDuplicate (self , nums ):
23+ return "" .join ([str (key ) for key , val in collections .Counter (nums ).items () if val != 1 ]) #Return the duplicate number
You can’t perform that action at this time.
0 commit comments