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