System Design Rate Limiter | Sliding Window Implementation | System Design Interview

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

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

  • @msingla135
    @msingla135 10 месяцев назад +2

    I feel this is a better way of implementing the refresh method:
    private void refresh(long currTimeInSec) {
    long cutoffTime = currTimeInSec - windowInSecs;
    while(!window.isEmpty() && window.peek() < cutoffTime)
    window.poll();
    }

  • @yournextdoortraveller
    @yournextdoortraveller 2 года назад +3

    Thanks for your video.
    One question. Do we actually need to calculate ''çalculatedTime' multiple time in while loop? Because the queue works on FIFO basis and if the top of the queue is expired for that sliding window isn't it the remaining entries of the queue also will be expired? Your thoughts please..

    • @devensingh5408
      @devensingh5408 2 года назад +1

      as you already mentioned the queue works as FIFO so the top of the queue is the oldest so time diff also will be greater and could exceed the defined limit, but the same could not be the case for the latest ones

  • @mehulparmar9976
    @mehulparmar9976 2 года назад +1

    Can you also make a video on Sliding window with counters. Or atleast guide what will change in this code? Awesome video between.

    • @bhawanasahu3000
      @bhawanasahu3000 11 месяцев назад

      To implement sliding with counter you can use map instead of queue. That would solve the requirement.

  • @mehulparmar9976
    @mehulparmar9976 2 года назад

    Employee class is not present while building the code

  • @aneksingh4496
    @aneksingh4496 2 года назад +1

    Nice video

    • @TheTechGranth
      @TheTechGranth  2 года назад

      Hope it was helpful. Do like and subscribe and share with others 🙂

  • @hassaantahir3861
    @hassaantahir3861 2 года назад +1

    Bro BlaBlaCar system design ... Plz

    • @TheTechGranth
      @TheTechGranth  2 года назад +1

      Basic idea will be like ola or uber, on top of this architecture you can add more functionality. Do check out this video and let me know if you are expecting something more
      ruclips.net/video/AbvBcmABjcI/видео.html