Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If a student with <code>nums[i] = x</code> is selected, all the students with <code>nums[j] <= x</code> must be selected.
If a student with <code>nums[i] = x</code> is not selected, all the students with <code>nums[j] >= x</code> must not be selected.
Sort values in <code>nums</code> and try all possible values for <code>x</code> from <code>0</code> to <code>n</code> separately.
Solve with full IDE support and test cases