A coastal watch authority operates n signal beacons strung along a shoreline. Each night, beacon i stays lit for hours[i] hours, and the authority requires every beacon to remain lit for at least target hours to be considered compliant for that night. Given the number of hours each beacon stayed lit, determine how many beacons met or exceeded the required quota.
The first line contains two integers n and target, the number of beacons and the minimum required number of lit hours. The second line contains n integers hours[0], hours[1], ..., hours[n-1], the number of hours each beacon stayed lit.
Print a single integer: the number of beacons whose recorded hours are greater than or equal to target.
Example 1
Input
5 5 4 5 6 7 3
Expected
3
Explanation
Beacons recorded 4, 5, 6, 7, and 3 lit hours against a quota of 5. The beacons with 5, 6, and 7 hours meet or exceed the quota, so the count is 3.
Example 2
Input
4 10 10 10 10 10
Expected
4
Explanation
All four beacons recorded exactly 10 lit hours, which equals the quota of 10, so every beacon counts and the answer is 4.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →