Number of Employees Who Met the Target

There are n employees numbered 0 to n - 1. Employee i has worked hours[i] hours. The company requires every employee to work at least target hours. Return the number of employees who worked at least target hours.

30:00

Number of Employees Who Met the Target
easy
Free written solution
Topics
Companies

There are n employees numbered 0 to n - 1. Employee i has worked hours[i] hours. The company requires every employee to work at least target hours. Return the number of employees who worked at least target hours.

Example 1:
Input: {"hours":[0,1,2,3,4],"target":2}
Output: 3
Constraints:
  • 1≤n==hours.length≤501 \leq n == \text{hours.length} \leq 50

  • 0≤hours[i],target≤1050 \leq \text{hours}[i], \text{target} \leq 10^5

Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result

Run code to see results.

Input
arr ={"hours":[0,1,2,3,4],"target":2}

Draw the target line at 2 hours. Every bar that reaches the line is an employee who met the target.

target = 2

met

0

hours worked

0

1

2

3

4

0

1

2

3

4

Variables
VariableValue
target2
count0
DepthFunction Call
Stack empty
0/11