We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a7c9fd commit a437e87Copy full SHA for a437e87
scripts/algorithms/A/Average Waiting Time/Average Waiting Time.java
@@ -1,14 +1,15 @@
1
+// Runtime: 16 ms (Top 7.49%) | Memory: 101.1 MB (Top 30.84%)
2
class Solution {
3
public double averageWaitingTime(int[][] customers) {
4
double time = 0;
5
double waitingTime = 0;
-
6
+
7
for(int[] cust : customers){
- time = Math.max(cust[0],time);
8
+ time = Math.max(cust[0],time);
9
time = time + cust[1];
10
waitingTime += (time - cust[0]);
11
}
12
13
return waitingTime/customers.length;
14
-}
15
+}
0 commit comments