502. IPO | heap | priority queue | leetcode daily challenge | DSA | Hindi

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • Problem Name:
    502. IPO
    Problem Statement:
    Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. Since it has limited resources, it can only finish at most k distinct projects before the IPO. Help LeetCode design the best way to maximize its total capital after finishing at most k distinct projects.
    You are given n projects where the ith project has a pure profit profits[i] and a minimum capital of capital[i] is needed to start it.
    Initially, you have w capital. When you finish a project, you will obtain its pure profit and the profit will be added to your total capital.
    Pick a list of at most k distinct projects from given projects to maximize your final capital, and return the final maximized capital.
    The answer is guaranteed to fit in a 32-bit signed integer.
    Complete Balanced Trees Playlist:
    • Balanced Trees Playlis...
    Problem link:
    leetcode.com/p...
    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​

КОМЕНТАРІ • 23

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

    Thank you for being a help in my leetcode daily challenge questions. I am on day 107. I really admire the way you teach every single thing in detail!

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

    Thank You Good Explain!!

  • @meme_Overflow
    @meme_Overflow 2 місяці тому

    bhai bade hi pyar se banayi gyi h playlist clear dikh rha h videos me

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  3 місяці тому +2

    please like the video if you understood the solution.

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

    thank u so much for explaining this. your videos are a daily motivation to atleast complete the leetcode daily challenge, even when it gets tough

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

    Please provide a playlist for heaps and priority queues
    Not able to find out in your channel

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

      ua-cam.com/play/PLQ7ZAf76c0ZMMbl0ZDeFlpNJvxGWaqt9c.html&si=U0r_sulAUyIS_GDQ

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

    Thank you so much! Aapke explanation samajh ke khud hi code kardiya! and it did'nt even feel like a hard question.

  • @mr.nishantawasthi4402
    @mr.nishantawasthi4402 3 місяці тому

    Starting se app se padh raha hu ....wait karta hu daily kyo ki app ka content other UA-camrs se acha hai

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

    Don't we have to remove all entries of max heap?

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

    Bhai subah se wait krra tha kab ayegi video
    Abh kudh hi krlia 🤣😂

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

    Sir can we Solve this by Sorting in following way
    public int compareTo(Project p1)
    {
    if(this.capital - p1.capital != 0)
    return this.capital - p1.capital;
    return p1.profit - this.profit;
    }
    Like Ascending order Sorting based on Capital but if Capitals are equal then sort based on profit in decreasing order..
    Please reply..

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

      Hi. I don't think think this will work.

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

      You have tried submitting it?

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

      ​@@shashwat_tiwari_st Yess Sir I tried it.. It sorted the objects as we require but couldn't get correct output.. Thank you sir 🙌🏻

  • @mr.nishantawasthi4402
    @mr.nishantawasthi4402 3 місяці тому

    Sir java DSA course Main ab kya padhne wale hai please reply 🙏🙏

  • @NishantPandat-l3q
    @NishantPandat-l3q 3 місяці тому

    java DSA course main ab kya padhne wale hai please reply aapne bola tha sir ki 1 june ko bataynge please reply

  • @TanushkaKashyap-cf7sd
    @TanushkaKashyap-cf7sd 3 місяці тому

    wrong answers aa rhe h!

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd 3 місяці тому

    first 🤩