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