File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ class Solution :
2
+ def containsDuplicate (self , nums : List [int ]) -> bool :
3
+ return len (set (nums ))!= len (nums )
4
+
Original file line number Diff line number Diff line change
1
+ class Solution :
2
+ def topKFrequent (self , nums : List [int ], k : int ) -> List [int ]:
3
+ dict_map = {}
4
+ for a in nums :
5
+ if a in dict_map :
6
+ dict_map [a ] += 1
7
+ else :
8
+ dict_map [a ] = 1
9
+ lst = sorted (dict_map .items (), key = lambda x : x [1 ], reverse = True ) # 공백 수정
10
+ return [item [0 ] for item in lst [0 :k ]]
11
+
Original file line number Diff line number Diff line change
1
+ class Solution :
2
+ def twoSum (self , nums : List [int ], target : int ) -> List [int ]:
3
+ for a in range (len (nums )):
4
+ for b in range (a + 1 ,len (nums )):
5
+ if nums [a ]+ nums [b ]== target :
6
+ return [a ,b ]
You can’t perform that action at this time.
0 commit comments