일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- LeetCode
- Protocol
- 시바견
- Python Implementation
- 프로그래머스
- shiba
- DWG
- iterator
- 715. Range Module
- kaggle
- Convert Sorted List to Binary Search Tree
- Regular Expression
- Class
- 109. Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- data science
- Python
- Generator
- 43. Multiply Strings
- Python Code
- 파이썬
- 운영체제
- concurrency
- attribute
- Substring with Concatenation of All Words
- t1
- 315. Count of Smaller Numbers After Self
- 컴퓨터의 구조
- Decorator
- 밴픽
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