일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Decorator
- Python Code
- 운영체제
- attribute
- data science
- Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- Convert Sorted List to Binary Search Tree
- 43. Multiply Strings
- 109. Convert Sorted List to Binary Search Tree
- 파이썬
- Regular Expression
- Python
- iterator
- 프로그래머스
- kaggle
- concurrency
- 밴픽
- 30. Substring with Concatenation of All Words
- t1
- Class
- shiba
- Protocol
- DWG
- Generator
- LeetCode
- 시바견
- 컴퓨터의 구조
- Python Implementation
- 715. Range Module
Archives
- Today
- Total
목록Count of Smaller Numbers After Self (1)
Scribbling
LeetCode: 315. Count of Smaller Numbers After Self
Several solutions and short analysis of each one. 1. List + Binary Search The most straightforward solution, however, time complexity is O(N**2). class Solution: def countSmaller(self, nums: List[int]) -> List[int]: from bisect import insort, bisect_left arr = [] count = [] for i in range(len(nums) - 1, -1, -1): num = nums[i] idx = bisect_left(arr, num) count.append(idx) insort(arr, num) return ..
Computer Science/Coding Test
2022. 2. 10. 11:22