일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Generator
- 43. Multiply Strings
- Convert Sorted List to Binary Search Tree
- 프로그래머스
- Regular Expression
- Python Code
- concurrency
- 315. Count of Smaller Numbers After Self
- 715. Range Module
- Protocol
- 컴퓨터의 구조
- data science
- DWG
- 30. Substring with Concatenation of All Words
- 밴픽
- Substring with Concatenation of All Words
- Python Implementation
- Class
- t1
- attribute
- 109. Convert Sorted List to Binary Search Tree
- Python
- 파이썬
- 시바견
- iterator
- shiba
- LeetCode
- kaggle
- 운영체제
Archives
- Today
- Total
목록1010. Pairs of Songs With Total Durations Divisible by 60 (1)
Scribbling
LeetCode: 1010. Pairs of Songs With Total Durations Divisible by 60
My own code is always messy. The idea is to sort the list and calculate sums. Time complexity will be O(NlogN) due to sorting. class Solution: def numPairsDivisibleBy60(self, time: List[int]) -> int: time = [t % 60 for t in time] time.sort() ret = 0 l, r = 0, len(time) - 1 while l < r: if time[l] + time[r] == 60: if time[l] == 30: cnt = 0 while l 0 else c[0] c[t] += 1 return ans
Computer Science/Coding Test
2022. 1. 3. 22:01