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