Random Pick With Weight | LeetCode 528 | C++, Java, Python

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • LeetCode Solutions: • LeetCode Solutions | L...
    June LeetCoding Challenge: • Playlist
    May LeetCoding Challenge: • Playlist
    *** Best Books For Data Structures & Algorithms for Interviews:*********
    1. Cracking the Coding Interview: amzn.to/2WeO3eO
    2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
    3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
    4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
    5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
    6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
    *****************************************************************************
    June LeetCoding Challenge | Problem 5 | Random Pick With Weight | 5 June,
    Facebook Coding Interview question,
    google coding interview question,
    leetcode,
    Random Pick With Weight,
    Random Pick With Weight c++,
    Random Pick With Weight Java,
    Random Pick With Weight python,
    Random Pick With Weight solution,
    528. Random Pick With Weight,
    #Facebook #CodingInterview #LeetCode #JuneLeetCodingChallenge #Google #Amazon

Komentáře • 18

  • @abhinavmishra7617
    @abhinavmishra7617 Před 4 lety +6

    Your explanations are bang on! I wish i had teachers like you in my university

  • @harigovind11
    @harigovind11 Před 3 lety +3

    I was asked this question twice by Facebook.

  • @luciferrex9613
    @luciferrex9613 Před 4 lety +1

    Hi what is the intution behind using cummulative probabilites ?

  • @birudaya9964
    @birudaya9964 Před 4 lety +1

    what they actually meant in the output portion, I meant how they are related to our return value

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety

      For large input sets they may be evaluating if the fraction of generated indices are roughly close to their weights in input.

  • @vikrantkaushal9650
    @vikrantkaushal9650 Před 4 lety

    Thank for the video. We are using random function so how does answer suppose to be match their expected answer in sample cases? I do understand that it should work on larger samples? Please explain.

  • @alifyamohamedali1002
    @alifyamohamedali1002 Před 3 lety +1

    Thank you :). Great explanation

  • @souravprasaddas5909
    @souravprasaddas5909 Před 4 lety +2

    Please make a video on comperators.

  • @Ankit-hs9nb
    @Ankit-hs9nb Před 2 lety

    would time complexity be O(NlogN)?

  • @divyashahi9364
    @divyashahi9364 Před 3 lety

    why haven't u used lower_bound it would have been more appropriate, but using lower_bound gives wrong ans from larger test input may you please explain that,
    BTW, really nice explanation.