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​

Комментарии • 14

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  Месяц назад +6

    like target is 90. Please do like, if you understood the solution😄😄

    • @Nishant89-i2z
      @Nishant89-i2z Месяц назад

      linkedin pe tag kardunga daily solve karne pe

  • @RahulKumar-et4pm
    @RahulKumar-et4pm Месяц назад

    basic question of cpu scheduling of Operating System.

  • @a3rdtierguy864
    @a3rdtierguy864 Месяц назад +1

    If someone solved merge interval he will definitely able to solve this.

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo Месяц назад +2

    Love from Australia❤

  • @saisree04
    @saisree04 Месяц назад

    Thank youu, your explanation is super simple and easy to follow. I am glad that i found your channel.

  • @kumaraniket1640
    @kumaraniket1640 Месяц назад +1

    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

  • @keshavgupta9174
    @keshavgupta9174 Месяц назад

    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;
    }
    }

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Месяц назад

    Thanks 😊

  • @adarshjain3058
    @adarshjain3058 Месяц назад +1

    attendance++;

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd Месяц назад

    aaj ka ho gya tha, mai attendance lagane aaya hu🤩🤩

  • @thAsciNileshPal
    @thAsciNileshPal Месяц назад +1

    samjhate theek ho ,but thoda dheere samjhaya kro ; bhaot speed me expalin karte ho ...time leke explain kiya kro

    • @shankitkumar820
      @shankitkumar820 Месяц назад +1

      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.

    • @thAsciNileshPal
      @thAsciNileshPal Месяц назад

      @@shankitkumar820 ha to khudse hi to kar raha code , konsa sir muje type kar k de rahe