2410. Maximum Matching of Players With Trainers
2023. 1. 7. 20:56ㆍAlgorithm/Leetcode, Lintcode, HackerRank, etc.
- 목차
반응형
Intuition
Approach
Complexity
Time complexity:
O(NlogN)
Space complexity:
O(1)
Code
class Solution:
def matchPlayersAndTrainers(self, players: List[int], trainers: List[int]) -> int:
cnt = 0
trainers.sort()
for player in sorted(players):
idx = bisect.bisect_left(trainers, player)
if idx >= len(trainers):
break
trainers.pop(idx)
cnt += 1
return cnt
반응형
'Algorithm > Leetcode, Lintcode, HackerRank, etc.' 카테고리의 다른 글
2395. Find Subarrays With Equal Sum (0) | 2023.01.24 |
---|---|
2405. Optimal Partition of String (0) | 2023.01.24 |
2409. Count Days Spent Together (0) | 2023.01.07 |
2244. Minimum Rounds to Complete All Tasks (0) | 2022.05.01 |
2243. Calculate Digit Sum of a String (0) | 2022.04.29 |