Tap here to switch tabs
Problem
Submissions

Problem: Maximum Matching of Players With Trainers

med
30 min
Try to solve the Maximum Matching of Players With Trainers problem.

Statement

You are given two 00 indexed integer arrays, players and trainers.

The value players[i] represents the ability of the iextthi^{ ext{th}} player, and trainers[j] represents the training capacity of the jextthj^{ ext{th}} trainer.

The iextthi^{ ext{th}} player can be matched with the jextthj^{ ext{th}} trainer if and only if players[i] ≤\leq trainers[j]. Each player can be matched with at most 11 trainer, and each trainer can be matched with at most 11 player.

Return the maximum number of matchings that can be formed between players and trainers.

Constraints:

  • 1≤1 \leq players.length, trainers.length ≤105\leq 10^5

  • 1≤1 \leq players[i], trainers[j] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Matching of Players With Trainers

med
30 min
Try to solve the Maximum Matching of Players With Trainers problem.

Statement

You are given two 00 indexed integer arrays, players and trainers.

The value players[i] represents the ability of the iextthi^{ ext{th}} player, and trainers[j] represents the training capacity of the jextthj^{ ext{th}} trainer.

The iextthi^{ ext{th}} player can be matched with the jextthj^{ ext{th}} trainer if and only if players[i] ≤\leq trainers[j]. Each player can be matched with at most 11 trainer, and each trainer can be matched with at most 11 player.

Return the maximum number of matchings that can be formed between players and trainers.

Constraints:

  • 1≤1 \leq players.length, trainers.length ≤105\leq 10^5

  • 1≤1 \leq players[i], trainers[j] ≤109\leq 10^9