1701. Average Waiting Time | Leetcode Daily Challlenge | Arrays | DSA | Hindi
HTML-код
- Опубликовано: 22 авг 2024
- Problem Name:
1701. Average Waiting Time
Problem Statement:
There is a restaurant with a single chef. You are given an array customers, where customers[i] = [arrivali, timei]:
arrivali is the arrival time of the ith customer. The arrival times are sorted in non-decreasing order.
timei is the time needed to prepare the order of the ith customer.
When a customer arrives, he gives the chef his order, and the chef starts preparing it once he is idle. The customer waits till the chef finishes preparing his order. The chef does not prepare food for more than one customer at a time. The chef prepares food for customers in the order they were given in the input.
Return the average waiting time of all customers. Solutions within 10-5 from the actual answer are considered accepted.
Problem Link:
leetcode.com/p...
Graph Playlist:
• Graph Data Structure S...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.co...
Notes:
github.com/Tiw...
Telegram Link:
shashwattiwari...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding #problemsolving
like target is 90. Please do like, if you understood the solution😄😄
linkedin pe tag kardunga daily solve karne pe
basic question of cpu scheduling of Operating System.
If someone solved merge interval he will definitely able to solve this.
Love from Australia❤
Thank youu, your explanation is super simple and easy to follow. I am glad that i found your channel.
really solving leetcode problem has been this much easy thank you for the proper explaination big fan sir , can you please make playlist on AWS fundamentals and also hand-on experience on it
class Solution {
public double averageWaitingTime(int[][] customers) {
int n = customers.length;
double totalWaitTime = 0;
int currTime = 0;
for (int[] customer : customers) {
int arrivalTime = customer[0];
int cookTime = customer[1];
if (currTime < arrivalTime) {
currTime = arrivalTime;
}
int waitTime = currTime + cookTime - arrivalTime;
totalWaitTime += waitTime;
currTime += cookTime;
}
return totalWaitTime / n;
}
}
Thanks 😊
attendance++;
aaj ka ho gya tha, mai attendance lagane aaya hu🤩🤩
samjhate theek ho ,but thoda dheere samjhaya kro ; bhaot speed me expalin karte ho ...time leke explain kiya kro
No, His speed is just fine. If he will make long videos of each question then no one will get interested as every video will be atleast half hour long. I would recommend you to try each and every step yourself and ask doubt on comment section.
@@shankitkumar820 ha to khudse hi to kar raha code , konsa sir muje type kar k de rahe