Anniversary
The Codefinity University is hosting a ballroom dance in celebration of its anniversary! n boys and m girls are already busy. We know that several boy and girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair must differ by at most one. For each boy, we know his dancing skills. Similarly, for each girl we know her dancing skills.
Given an array of boys with dancing skill and array of girls with dancing skills, return the largest possible number of pairs that can be formed from boys and girls.
Example 1
Input:
boys = [1, 4, 6, 2]; girls = [5, 1, 5, 7, 9];
Output:
3
main.cpp
C++
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione