일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- DWG
- 프로그래머스
- concurrency
- attribute
- data science
- kaggle
- 운영체제
- shiba
- 43. Multiply Strings
- Class
- Python
- 109. Convert Sorted List to Binary Search Tree
- 파이썬
- Python Implementation
- t1
- 715. Range Module
- Python Code
- 시바견
- 밴픽
- 컴퓨터의 구조
- Protocol
- Substring with Concatenation of All Words
- Decorator
- LeetCode
- 315. Count of Smaller Numbers After Self
- Regular Expression
- 30. Substring with Concatenation of All Words
- iterator
- Generator
- Convert Sorted List to Binary Search Tree
Archives
- Today
- Total
목록Find All Duplicates in an Array (1)
Scribbling
LeetCode: 442. Find All Duplicates in an Array
O(N), O(1) Solution by using input array as a memory. class Solution: def findDuplicates(self, nums: List[int]) -> List[int]: ret = [] for i, num in enumerate(nums): if nums[abs(num) - 1] < 0: ret.append(abs(num)) nums[abs(num) - 1] *= -1 return ret
Computer Science/Coding Test
2022. 1. 5. 11:08