2410. Maximum Matching of Players With Trainers

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2410

class Solution:
    def matchPlayersAndTrainers(self, players: List[int], trainers: List[int]) -> int:
        players.sort()
        trainers.sort()
        res = j = 0
        for p in players:
            while j < len(trainers) and trainers[j] < p:
                j += 1
            if j < len(trainers):
                res += 1
                j += 1
        return res