2798. Number of Employees Who Met the Target Easy
1/**
2 * [2798] Number of Employees Who Met the Target
3 *
4 * There are n employees in a company, numbered from 0 to n - 1. Each employee i has worked for hours[i] hours in the company.
5 * The company requires each employee to work for at least target hours.
6 * You are given a 0-indexed array of non-negative integers hours of length n and a non-negative integer target.
7 * Return the integer denoting the number of employees who worked at least target hours.
8 *
9 * <strong class="example">Example 1:
10 *
11 * Input: hours = [0,1,2,3,4], target = 2
12 * Output: 3
13 * Explanation: The company wants each employee to work for at least 2 hours.
14 * - Employee 0 worked for 0 hours and didn't meet the target.
15 * - Employee 1 worked for 1 hours and didn't meet the target.
16 * - Employee 2 worked for 2 hours and met the target.
17 * - Employee 3 worked for 3 hours and met the target.
18 * - Employee 4 worked for 4 hours and met the target.
19 * There are 3 employees who met the target.
20 *
21 * <strong class="example">Example 2:
22 *
23 * Input: hours = [5,1,4,2,2], target = 6
24 * Output: 0
25 * Explanation: The company wants each employee to work for at least 6 hours.
26 * There are 0 employees who met the target.
27 *
28 *
29 * Constraints:
30 *
31 * 1 <= n == hours.length <= 50
32 * 0 <= hours[i], target <= 10^5
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/number-of-employees-who-met-the-target/
38// discuss: https://leetcode.com/problems/number-of-employees-who-met-the-target/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn number_of_employees_who_met_target(hours: Vec<i32>, target: i32) -> i32 {
44 0
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_2798() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.