-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6740357
commit 8c7da05
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...age-25/2798. Number of Employees Who Met the Target/numberOfEmployeesWhoMetTarget.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { numberOfEmployeesWhoMetTarget } from './numberOfEmployeesWhoMetTarget'; | ||
|
||
describe('2798. Number of Employees Who Met the Target', () => { | ||
test('numberOfEmployeesWhoMetTarget', () => { | ||
expect(numberOfEmployeesWhoMetTarget([0, 1, 2, 3, 4], 2)).toBe(3); | ||
expect(numberOfEmployeesWhoMetTarget([5, 1, 4, 2, 2], 6)).toBe(0); | ||
}); | ||
}); |
8 changes: 8 additions & 0 deletions
8
src/page-25/2798. Number of Employees Who Met the Target/numberOfEmployeesWhoMetTarget.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type numberOfEmployeesWhoMetTarget = (hours: number[], target: number) => number; | ||
|
||
/** | ||
* Accepted | ||
*/ | ||
export const numberOfEmployeesWhoMetTarget: numberOfEmployeesWhoMetTarget = (hours, target) => { | ||
return hours.filter((hour) => hour >= target).length; | ||
}; |