You are given a 0-indexed integer array
nums
of lengthn
wheren
is the total number of students in the class. The class teacher tries to select a group of students so that all the students remain happy.The
ith
student will become happy if one of these two conditions is met:
- The student is selected and the total number of selected students is strictly greater than
nums[i]
.- The student is not selected and the total number of selected students is strictly less than
nums[i]
.Return the number of ways to select a group of students so that everyone remains happy.
1 | class Solution { |