Given two integer arrays and where stores the ages of different students and the stores the number of chocolates in the package (the full array represents the number of packages). Candy can be distributed to students in such a way that:

- Each student should receive only one box of candy.
- All students of the same age should receive the same amount of candy.
- The older student should receive more sweets than all the younger students.

The challenge is to determine if candy can be dispensed in this manner. If possible, print more print ,

** Examples :**

Input:ages [] = {5, 15, 10}, packs [] = {2, 2, 2, 3, 3, 4}

Output:YES

There are 3 students with age 5, 15 and 10.And there are 6 packets of candies containing 2, 2, 2, 3, 3, 4 candies respectively.

We will give one packet containing 2 candies to the student of age 5, one packet containing 3 candies to student with age 10 and give the packet containing 4 candies to student age 15

Input:ages [] = {5, 5, 6, 7}, packs [] = {5, 4, 6, 6}

Output:NO

** Fit :**

- Make 2 frequency arrays, one of which will store the number of students with a specific age and the other — number of bags with a certain amount of sweets.
- Then browse the frequency array for ages starting at the youngest age, and for each age in ascending order, try to find bags of sweets that are greater than or equal to the number of students for the selected age (starting with smallest number of candies in a bag)
- If the above case fails then answer otherwise repeat the steps above until all students will not receive candy and will print finally.

Below is the implementation of the above approach:

```
``` |

** Exit :**

YES

X
# Submit new EBook