java.lang.Object
g2701_2800.s2798_number_of_employees_who_met_the_target.Solution

public class Solution extends Object
2798 - Number of Employees Who Met the Target.<p>Easy</p> <p>There are <code>n</code> employees in a company, numbered from <code>0</code> to <code>n - 1</code>. Each employee <code>i</code> has worked for <code>hours[i]</code> hours in the company.</p> <p>The company requires each employee to work for <strong>at least</strong> <code>target</code> hours.</p> <p>You are given a <strong>0-indexed</strong> array of non-negative integers <code>hours</code> of length <code>n</code> and a non-negative integer <code>target</code>.</p> <p>Return <em>the integer denoting the number of employees who worked at least</em> <code>target</code> <em>hours</em>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> hours = [0,1,2,3,4], target = 2</p> <p><strong>Output:</strong> 3</p> <p><strong>Explanation:</strong></p> <p>The company wants each employee to work for at least 2 hours.</p> <ul> <li> <p>Employee 0 worked for 0 hours and didn&rsquo;t meet the target.</p> </li> <li> <p>Employee 1 worked for 1 hours and didn&rsquo;t meet the target.</p> </li> <li> <p>Employee 2 worked for 2 hours and met the target.</p> </li> <li> <p>Employee 3 worked for 3 hours and met the target.</p> </li> <li> <p>Employee 4 worked for 4 hours and met the target.</p> </li> </ul> <p>There are 3 employees who met the target.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> hours = [5,1,4,2,2], target = 6</p> <p><strong>Output:</strong> 0</p> <p><strong>Explanation:</strong></p> <p>The company wants each employee to work for at least 6 hours.</p> <p>There are 0 employees who met the target.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= n == hours.length <= 50</code></li> <li><code>0 <= hours[i], target <= 10<sup>5</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • numberOfEmployeesWhoMetTarget

      public int numberOfEmployeesWhoMetTarget(int[] hours, int target)