Problem Statement
There are N girls auditioning for an idol competition. You are a junior producer of the competition. During the auditions you have evaluated the talent and the skill of each candidate. The results of these evaluations are given in the int[]s talent and skill: for each valid i, talent[i] is the amount of talent and skill[i] the amount of skill candidate i has shown.
Your task is to decide which girls advance to the second stage of the selection process. In order to do this, you came up with a simple rule: girl A will advance if and only if there is no other girl B such that B has both strictly more talent and strictly more skill than A.
Please calculate and return the number of girls who advance to the second stage.
Definition
- Class:
- CinderellaGirls
- Method:
- count
- Parameters:
- int[], int[]
- Returns:
- int
- Method signature:
- int count(int[] talent, int[] skill)
- (be sure your method is public)
Constraints
- N will be between 2 and 50, inclusive.
- talent will contain exactly N elements.
- skill will contain exactly N elements.
- Each element in talent will be between 1 and 10,000, inclusive.
- Each element in skill will be between 1 and 10,000, inclusive.
Examples
{10,20,30}{30,20,10}Returns: 3
Every girl will be accepted.{10,20,30}{10,20,30}Returns: 1
In this case, girls 0 and 1 will not be accepted because girl 2 has more talent and more skill than each of the other two.{10,10,10}{1,100,10000}Returns: 3
Their skill scores differ significantly but their talent scores are the same so every girl will be invited to the second stage.{46,70,39,53,10,47,73,95,95,27}{81,47,64,65,34,55,75,16,80,69}Returns: 3