array and dic
This commit is contained in:
		
							
								
								
									
										10
									
								
								26-240604-pass/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								26-240604-pass/main.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| class Solution: | ||||
|     def removeDuplicates(self, nums: List[int]) -> int: | ||||
|         k = {} | ||||
|         cnt = 0 | ||||
|         for num in nums: | ||||
|             if num not in k: | ||||
|                 nums[cnt] = num | ||||
|                 cnt += 1 | ||||
|                 k[num] = 1 | ||||
|         return cnt | ||||
		Reference in New Issue
	
	Block a user