Practice Maximum Matching of Players With Trainers
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed integer array players, where players[i] represents the ability of the ith player. You are also given a 0-indexed integer array trainers, where trainers[j] represents the training capacity of the jth trainer. The ith player can match with the jth trainer if the player's ability is less than or equal to the trainer's training capacity. Additionally, the ith player can be matched with at most one trainer, and the jth trainer can be matched with at most one player. Return the maximum number of matchings between players and trainers that satisfy these conditions. Example 1: Example 2: Constraints: Note: This question is the same as 445: Assign Cookies.
Source: Maximum Matching of Players With Trainers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
players = [4,7,9], trainers = [8,2,5,8]
2
# Example 2
players = [1,1,1], trainers = [10]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Matching of Players With Trainers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.