File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
finding-the-users-active-minutes Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ Step 2. Add the dependency
49
49
50
50
<summary >展开查看</summary >
51
51
52
+ https://leetcode.cn/problems/finding-the-users-active-minutes
53
+
52
54
https://leetcode.cn/problems/strong-password-checker-ii/
53
55
54
56
https://leetcode.cn/problems/finding-mk-average
Original file line number Diff line number Diff line change
1
+ function findingUsersActiveMinutes ( logs : number [ ] [ ] , k : number ) : number [ ] {
2
+ const activeMinutes = new Map < number , Set < number > > ( ) ;
3
+ for ( const [ id , time ] of logs ) {
4
+ if ( ! activeMinutes . has ( id ) ) {
5
+ activeMinutes . set ( id , new Set ( ) ) ;
6
+ }
7
+ activeMinutes . get ( id ) ?. add ( time ) ;
8
+ }
9
+ const answer : number [ ] = new Array ( k ) . fill ( 0 ) ;
10
+ for ( const minutes of activeMinutes . values ( ) ) {
11
+ const activeCount = minutes . size ;
12
+ answer [ activeCount - 1 ] ++ ;
13
+ }
14
+ return answer ;
15
+ }
16
+ export default findingUsersActiveMinutes ;
You can’t perform that action at this time.
0 commit comments