File tree 4 files changed +33
-2
lines changed
solution/1700-1799/1701.Average Waiting Time
4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 3
3
.vscode
4
4
.temp
5
5
.cache
6
+ * .iml
7
+ __pycache__
6
8
/node_modules
7
9
/solution /result.json
8
10
/solution /__pycache__
9
- /solution /.env
10
- * .iml
11
+ /solution /.env
Original file line number Diff line number Diff line change @@ -125,6 +125,17 @@ func averageWaitingTime(customers [][]int) float64 {
125
125
}
126
126
```
127
127
128
+ ``` ts
129
+ function averageWaitingTime(customers : number [][]): number {
130
+ let [tot, t] = [0 , 0 ];
131
+ for (const [a, b] of customers ) {
132
+ t = Math .max (t , a ) + b ;
133
+ tot += t - a ;
134
+ }
135
+ return tot / customers .length ;
136
+ }
137
+ ```
138
+
128
139
<!-- tabs: end -->
129
140
130
141
<!-- end -->
Original file line number Diff line number Diff line change @@ -121,6 +121,17 @@ func averageWaitingTime(customers [][]int) float64 {
121
121
}
122
122
```
123
123
124
+ ``` ts
125
+ function averageWaitingTime(customers : number [][]): number {
126
+ let [tot, t] = [0 , 0 ];
127
+ for (const [a, b] of customers ) {
128
+ t = Math .max (t , a ) + b ;
129
+ tot += t - a ;
130
+ }
131
+ return tot / customers .length ;
132
+ }
133
+ ```
134
+
124
135
<!-- tabs: end -->
125
136
126
137
<!-- end -->
Original file line number Diff line number Diff line change
1
+ function averageWaitingTime ( customers : number [ ] [ ] ) : number {
2
+ let [ tot , t ] = [ 0 , 0 ] ;
3
+ for ( const [ a , b ] of customers ) {
4
+ t = Math . max ( t , a ) + b ;
5
+ tot += t - a ;
6
+ }
7
+ return tot / customers . length ;
8
+ }
You can’t perform that action at this time.
0 commit comments