Better video in comments | Chocolate Distribution Problem | Hindi | Geeks for Geeks | GFG | FAANG

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 23

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  9 หลายเดือนก่อน

    Please find below video with better sound quality ❤
    th-cam.com/video/oYNU1TD9W5Y/w-d-xo.htmlsi=MLzZEX3MghRNe0LY

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  ปีที่แล้ว +1

    This is a very old video, for better sound and camera quality DSA videos, learn from the below playlist!
    Java Plus DSA ( Java + DSA + Problem Solving )
    th-cam.com/play/PLQ7ZAf76c0ZPVdhV1bAjFv0bQc1xHURzE.html

  • @rehan4651
    @rehan4651 ปีที่แล้ว

    how is i+m-1

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  ปีที่แล้ว +1

      No.
      See consider it as starting and ending point., we need to consider all elements and shift them to a window of size exactly m.
      Let's say m=3.
      Elements are
      1 2 3 4 5
      So first window would be
      1 2 3
      2nd would be
      2 3 4
      3rd would be
      3 4 5
      Now can we take
      4 5 ??
      No we can't because window size is 3 and we are left with only 2 elements.
      So what was the starting element of last valid window, it is 3.
      Let's check indexes now.
      Element 1 2 3 4 5
      Index. 0 1 2 3 4
      Index of 3 is 2.
      So valid Iteration is from i=0 to i=2.
      That is why this equation will work i+m-1

  • @rishiSingh0898
    @rishiSingh0898 2 ปีที่แล้ว +4

    I am not able to understand from i+m

  • @sonurathod9551
    @sonurathod9551 2 ปีที่แล้ว +4

    you explained very nicely👍

  • @Abhay14
    @Abhay14 ปีที่แล้ว

    thank you bhaiya itni achhi tarah samjhane k liye

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  ปีที่แล้ว

      No problem. Java Plus dsa course chal rha hai, pls share with your juniors. 😃

  • @kosuribalaji317
    @kosuribalaji317 7 หลายเดือนก่อน

    Thank you for the explanation

  • @nishagawade3545
    @nishagawade3545 ปีที่แล้ว

    i

  • @masumali8356
    @masumali8356 หลายเดือนก่อน

    lovely

  • @SiddheshKukade
    @SiddheshKukade ปีที่แล้ว

    thanks

  • @yogeshdani0209
    @yogeshdani0209 2 ปีที่แล้ว +1

    आप Lbsnaa गए हो????

  • @girloutofurleague
    @girloutofurleague 2 ปีที่แล้ว +1

    can u publish the swift code for the same

  • @lalit-singh-bisht
    @lalit-singh-bisht ปีที่แล้ว

    can we do this O(n) time

  • @AbhishekSingh-lz2mi
    @AbhishekSingh-lz2mi 2 ปีที่แล้ว +1

    Can Anyone please Explain:
    Math.min(a.get(i+(int)m-1)+a.get(i), minDiff);

    • @shashwat_tiwari_st
      @shashwat_tiwari_st  2 ปีที่แล้ว +4

      We have window of M elements,
      We add the first and last element of the window, and check if it is less than any of the previous window. Then repeat this process.
      Math.min( A , B ) ; means return minimum value.
      B means previous ans.
      A means a.get( i + m - 1 ) + a.get( i )
      a.get (i + m - 1) means last element of window.
      a.get (i) means first element of window.

  • @MrKB_SSJ2
    @MrKB_SSJ2 ปีที่แล้ว

    Isn't this a brute force solution ?

  • @ashishlad2246
    @ashishlad2246 ปีที่แล้ว

    Accenture 2023 aptitude coding question

  • @AmitYadav-Agra
    @AmitYadav-Agra 2 ปีที่แล้ว +3

    I don't want chocolate