Tap here to switch tabs
Problem
Submissions

Problem: Maximum Matching of Players With Trainers

Maximum Matching of Players With Trainers pairs players and trainers when a player's ability is no greater than a trainer's capacity. Return the largest number of one-to-one matches.

Statement

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

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

The ithi^{ {th}} player can be matched with the jthj^{ {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

Maximum Matching of Players With Trainers pairs players and trainers when a player's ability is no greater than a trainer's capacity. Return the largest number of one-to-one matches.

Statement

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

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

The ithi^{ {th}} player can be matched with the jthj^{ {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