Given 2 arrays or vectors of scores in 2 subjects of N students.
A student will fail if any other student has obtained more marks in both the subjects.
Find the number of passing students.
Example:
Input:
Student 1: {100 , 80}
Student 2: {90 , 70}
Student 3: {60 , 80}
Student 4: {60 , 70}
Output:
2
Explanation:
Student 2 has less marks in both subjects than student 1, so failed.
Student 4 has less marks in both subjects than student 1, so failed.How to solve the question in O(N^2) and also in better time complexity than O(N^2) ?