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++
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion