1701. Average Waiting Time | Simulation | Array

preview_player
Показать описание
In this video, I'll talk about how to solve Leetcode 1701. Average Waiting Time | Simulation | Array

Let's Connect:

About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)

✨ Timelines✨

✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
Рекомендации по теме
Комментарии
Автор

Solved but visited this video for another approach. Great work especially comparing the model questions that's very good way to do.

chakri
Автор

Bro weekly contest ke solution nahi dale. What happened?

redeye
Автор

i believe this is an easy question:


class Solution {
public:
double customers) {
double waittime=0;
int time=customers[0][0];
int n=customers.size();
for(int i=0;i<n;i++){
if(customers[i][0]>time){

}
else{
time+=customers[i][1];
}

}
return waittime/n;

}
};

naamnhibataunga
Автор

I am sure this everyone can understand
class Solution {
public double averageWaitingTime(int[][] customers) {
int n = customers.length;
// Calcuclate the completion time for each process
int completionTime = customers[0][0];
double sum = 0;
for(int i=0;i<n;i++){
int AT = customers[i][0];
int BT = customers[i][1];

if(completionTime >= AT){
completionTime += BT;
}
else{
completionTime = AT + BT;
}

int tat = completionTime - AT;
sum += tat;
}



return sum/n;

}
}

codecraftV
Автор

You haven't uploaded the solution of weekly contest 405 happened on Sunday, 7 july 2024

ManishRohila-ic
Автор

Its like FCFS turn around time (cpu scheduling)

randomlad