일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 프로그래머스
- Substring with Concatenation of All Words
- 컴퓨터의 구조
- Decorator
- 715. Range Module
- 30. Substring with Concatenation of All Words
- t1
- shiba
- Python Implementation
- concurrency
- 시바견
- 파이썬
- DWG
- LeetCode
- Generator
- 109. Convert Sorted List to Binary Search Tree
- data science
- Class
- Protocol
- 밴픽
- Python
- kaggle
- Convert Sorted List to Binary Search Tree
- 운영체제
- iterator
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- Python Code
- attribute
- Regular Expression
Archives
- Today
- Total
목록315. Count of Smaller Numbers After Self (2)
Scribbling
Number of pairs that satisfies the range condition (lower <= p[i] - p[j] <= upper)
How does one can find the number of pairs in an array that satisfies the below condition? : lower
Computer Science/Algorithms & Data Structures
2023. 5. 15. 17:26
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