2410.cpp (369B)
1 class Solution { 2 public: 3 int matchPlayersAndTrainers(vector<int> &players, vector<int> &trainers) { 4 sort(begin(players), end(players)); 5 sort(begin(trainers), end(trainers)); 6 7 int res = 0; 8 for (int i = 0; res < players.size() && i < trainers.size(); i++) 9 res += trainers[i] >= players[res]; 10 return res; 11 } 12 };