502. IPO | Greedy | Priority Queue | Sorting

Поділитися
Вставка
  • Опубліковано 28 вер 2024
  • In this video, I'll talk about how to solve Leetcode 502. IPO | Greedy | Priority Queue | Sorting | Zeta | Salesforce | Amazon
    How to balance College & CP - • How to Balance ⚖️ Codi...
    Let's Connect:
    📱Discord (Join Community) : / discord
    📝Linkedin: / aryan-mittal-0077
    📸 Instagram: / codewitharyanbhai
    💻 Twitter - / aryan_mittal007
    🤖 Github: github.com/ary...
    About Me:
    I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
    ✨ Timelines✨
    ✨ Hashtags ✨
    #programming #Interviews #leetcode #faang #maang #datastructures #algorithms

КОМЕНТАРІ • 38

  • @ARYANMITTAL
    @ARYANMITTAL  3 місяці тому +1

    How to balance College & CP - ua-cam.com/video/79rxV2d86ww/v-deo.html

  • @shrutivvv
    @shrutivvv 3 місяці тому

    Amazing explanation...pls explain like this only..❤

  • @arcade320
    @arcade320 3 місяці тому +6

    Please Explain like this only today i easily understand what you are trying to explain otherwise i can't get what you try mostly...please explain like this only each and every thing should be crystal clear..Thankyou Aryan

    • @parthtammiwar8609
      @parthtammiwar8609 3 місяці тому

      he always explains clearly,maybe you are 😮‍💨

    • @arcade320
      @arcade320 3 місяці тому +1

      @@parthtammiwar8609 yeah i am dumb not smart as you , you could be a scientist in NASA in future , get lost i have't asked for your advice . BE careful from next time okay ? stupid??

    • @arcade320
      @arcade320 3 місяці тому

      @@parthtammiwar8609 shut up get lost

  • @agtonybarletta
    @agtonybarletta 3 місяці тому

    Thank you for the video, your detailed and slow pace explanation made it much easier to understand 👍

  • @funnyanimation888
    @funnyanimation888 3 місяці тому

    This was really easy to understand and straight to the point .Thanks a lot.

  • @parthtammiwar8609
    @parthtammiwar8609 3 місяці тому

    bro can you please upload gfg potd ,it would be a great help,as your explanation skill are aweasom

  • @mathy642
    @mathy642 3 місяці тому

    Excellent approach.

  • @sanebrain3083
    @sanebrain3083 3 місяці тому +1

    3:19 if you have already understood the question , the solution begins her

  • @parasd2802
    @parasd2802 3 місяці тому

    thanks for this explanation, also if possible can you please share wtv you write on your screen, would just love to go through it

  • @Flynn-lk8im
    @Flynn-lk8im 3 місяці тому

    What makes this different from the typical knapsack problem so that we don't apply DP?

  • @mohit7717
    @mohit7717 3 місяці тому

    When I am not able to solve daily leetcode POTD then I prefer your video... I have some doubt can you please answer here.. I have not learn Greedy, heap and priority queue yet .. So its good to solve daily POTD after understanding your solution or what the correct way .. Can u please suggest me?

  • @namannema3349
    @namannema3349 3 місяці тому

    nice approach

  • @rishiarora8123
    @rishiarora8123 3 місяці тому

    nicely explained man!

  • @yummytoeat3433
    @yummytoeat3433 3 місяці тому

    Please write a bit bigger. It will help us

  • @GYANKIBAAT-ze7nd
    @GYANKIBAAT-ze7nd 3 місяці тому

    Aryan can you why can't we apply DP here?

    • @6mahine_mein_google
      @6mahine_mein_google 3 місяці тому

      it will give TLE as u have to keep track of k and current capital .. TC of dp solution will be 1e14 and you can do it only after sorting the capital,profit array...
      from there we got greedy solution idea

  • @devahuja9052
    @devahuja9052 3 місяці тому

    Hey Aryan !
    Hoping you will reply to my query
    When I first saw this question, I thought of the dp approach and kinda related to the reward part 2 question that recently showed up in the weekly contest 401 and you made a video solving it using bitset, can't this question be solved the same way?
    Kindly guide
    Moreover thankyou so much for such amazing content, keep going!

    • @Vikram_Singh-d9c
      @Vikram_Singh-d9c 3 місяці тому

      bro what is DP? and I haven't learned greedy approaches till now how to start?

  • @naamnhibataunga5897
    @naamnhibataunga5897 3 місяці тому +1

    brother can you please make a video explaining question 128..
    using this solution:-
    class Solution {
    public:
    int longestConsecutive(vector& nums) {
    unordered_map m;
    int r = 0;
    for (int i : nums)
    if (!m[i]) {
    m[i] = m[i - 1] + m[i + 1] + 1;
    m[i - m[i - 1]] = m[i];
    m[i + m[i + 1]] = m[i];
    r = max(r, m[i]);
    }
    return r;
    }
    };
    i am still not able to understand it.

  • @shivendrasingh8520
    @shivendrasingh8520 3 місяці тому

    bhai thoda dhire bol dete.... plz

  • @shivendrasingh8520
    @shivendrasingh8520 3 місяці тому +1

    atleast pehle question to dhire dhire batao bhai

  • @aishwaryasuresh3610
    @aishwaryasuresh3610 Місяць тому

    This s such a great explanation, starting from why dp and going in the direction of dp and why we cant do dp. Incredible.

  • @TON-108
    @TON-108 3 місяці тому +4

    42k ❤‍🔥

  • @iamnoob7593
    @iamnoob7593 3 місяці тому

    Aryan man , This is beautiful explanation.

  • @anubhavdeepankar6681
    @anubhavdeepankar6681 3 місяці тому

    can we say priority queue will be of size : at max size k ? , just an observation

  • @vageshnp6792
    @vageshnp6792 3 місяці тому

    tq

  • @AnordinaryMan007
    @AnordinaryMan007 3 місяці тому +1

    I was thinking in the direction of profit then but capital is more important their

  • @Anonymous____________A721
    @Anonymous____________A721 3 місяці тому +1

    Sir
    Why not sorting with profit-capital value

    • @prashantsahu5117
      @prashantsahu5117 3 місяці тому

      because we will loss the indexes of profit and capital both

    • @Anonymous____________A721
      @Anonymous____________A721 3 місяці тому

      @@prashantsahu5117 we can take by creating vector of pairs

    • @kondekarvaishnavi2348
      @kondekarvaishnavi2348 3 місяці тому

      since we need at least capital of w to consume a project. Inorder to make sure that we will sort based on capital profit value. If we sort the profit-capital value in descending order but how u will make sure that u will get u have that amount of capital as profit with u? so this is y we sorted capital-profit

  • @harshal8781
    @harshal8781 3 місяці тому +1

    congo for 42k AM ♥

  • @_._Harsh_._
    @_._Harsh_._ 3 місяці тому

    Excellent Explanation!