LeetCode 763. Partition Labels (Solution Explained)

Sdílet
Vložit
  • čas přidán 20. 09. 2019
  • The Best Place To Learn Anything Coding Related - bit.ly/3MFZLIZ
    Join my free exclusive community built to empower programmers! - www.skool.com/software-develo...
    Preparing For Your Coding Interviews? Use These Resources
    --------------------
    (My Course) Data Structures & Algorithms for Coding Interviews - thedailybyte.dev/courses/nick
    AlgoCademy - algocademy.com/?referral=nick...
    Daily Coding Interview Questions - bit.ly/3xw1Sqz
    10% Off Of The Best Web Hosting! - hostinger.com/nickwhite
    Follow My Twitter - / nicholaswwhite
    Follow My Instagram - / nickwwhite
    Other Social Media
    ----------------------------------------------
    Discord - / discord
    Twitch - / nickwhitettv
    TikTok - / nickwhitetiktok
    LinkedIn - / nicholas-w-white
    Show Support
    ------------------------------------------------------------------------------
    Patreon - / nick_white
    PayPal - paypal.me/nickwwhite?locale.x...
    Become A Member - / @nickwhite
    #coding #programming #softwareengineering
  • Věda a technologie

Komentáře • 50

  • @meowmr9
    @meowmr9 Před rokem +2

    Has someone ever told you how easy you make it to understand complicated problems and solutions? It's all because of you that I have started solving leetcode problems on my own and going to interview with TikTok very soon for a SDE role. Thanks for putting up all these videos online :)

  • @Krishna42570
    @Krishna42570 Před 4 lety +15

    Plsss doooo hackerrank,codechef and alsoo continue doingg this leetcode...anyway ur explanation is awesome

  • @canobiggs
    @canobiggs Před 4 lety +11

    Excellent explanation! Thank you.

  • @free-palestine000
    @free-palestine000 Před 4 lety +5

    nick coming thru with the solutions 💯

  • @rollinggoronable
    @rollinggoronable Před 2 lety

    old I know, but you explained perfectly, the "in at most part" made no sense reading it, you saying it was a head slap moment

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

    Loved the explanation. This is coding question from Amazon :)

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

    Thank you very much for your excellent explanation!

  • @quirkyquester
    @quirkyquester Před 3 lety

    great explanation! Thank you Nick!

  • @flamencoag
    @flamencoag Před 4 lety

    Thanks! It is more clear than explanation on Leetcode's Solution section

  • @maryannegichohi7063
    @maryannegichohi7063 Před 3 lety

    Your Explanations are awesome such a life saver

  • @karthikbhat181
    @karthikbhat181 Před 4 lety

    Thank you so much for the wonderful explanation :)

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

    shout out for explaining it so well.

  • @TharaMesseroux1
    @TharaMesseroux1 Před 2 lety

    Great Explanation! Thank you!

  • @raam2508
    @raam2508 Před 4 lety +3

    very good explanation...a question Nick ! I have a Google screening round, a telephonic one. LeetCode questions are enough for practice ? Can you please tell me what should be the good material to clear that round? Thanks in advance.

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

    Great video. Thanks a lot 😊👍

  • @Abood99222
    @Abood99222 Před 3 lety

    thanks this really helped!

  • @NeverGiveUp186
    @NeverGiveUp186 Před 4 lety

    Excellent approach..I wish you could be a professor at my college 🙌🙌🙌🙌

  • @kamalkumar945
    @kamalkumar945 Před 2 lety

    Thank You Nick

  • @udaychatterjee4424
    @udaychatterjee4424 Před 3 lety

    Wow! Great solution

  • @anupamanair1299
    @anupamanair1299 Před 2 lety

    excellent solution

  • @abhimanyusaini5
    @abhimanyusaini5 Před 3 lety

    Thanks, Nice explanation :)

  • @u2blr
    @u2blr Před 3 lety

    Really nice video.
    This question statement is very confusing.
    Your explanation make it easy to understand

  • @Noname-wp6zt
    @Noname-wp6zt Před 3 lety

    Cool explaination

  • @kirank3368
    @kirank3368 Před 3 lety

    You are awesome 👏🏽

  • @sahithimangalapalli3068

    absolutely helpful :)

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

    S will have length in range [1, 500] then why base condition?

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

    You are awesome..

  • @chenpeter4817
    @chenpeter4817 Před 2 lety

    clear explanation

  • @sunnyday12131
    @sunnyday12131 Před 3 lety

    good explanation ! Happy2021

  • @chilld3666
    @chilld3666 Před 4 lety

    nice job!!!!

  • @shubhamchourasia2265
    @shubhamchourasia2265 Před 3 lety

    You are fabulous. Just want to know how do u approach such non trivial problem/solution ?

  • @Cccc-es3tu
    @Cccc-es3tu Před 3 lety

    good explanation, but i think in line 14, i should equal to start , right?

  • @uzumakinaruto6945
    @uzumakinaruto6945 Před 2 lety

    The answer in my case is wrong by changing the like 17 BY
    arr.push_back(end+1-start);
    gives a fine answer

  • @GiggsMain
    @GiggsMain Před 2 lety

    How is it constance space? Isn't last_indices an array which is O(n) space?

  • @90krishika
    @90krishika Před 4 lety +1

    We can do it without the extra space of int[]

  • @vikramchaudhary440
    @vikramchaudhary440 Před 3 lety

    I always like your video first before watching it

  • @divyabharti9879
    @divyabharti9879 Před 3 lety

    For loop should be int i = start instead of 0 .

  • @revanthsaireddyreddammagar268

    class Solution(object):
    def compressAndGetRanges(self, rangeDict):
    # Compress overlapping ranges in the given rangeDict and return the compressed ranges
    cRanges = [] # Stack to store compressed ranges
    for key, value in rangeDict.items():
    print(key, value)
    # Check if the stack is not empty and if the current range intersects with the last range in the stack
    if len(cRanges) != 0 and self.isIntersection(value, cRanges[-1]):
    # Merge the intersecting ranges and push the merged range onto the stack
    cRanges.append(self.mergeRange(cRanges.pop(), value))
    else:
    # Push the current range onto the stack
    cRanges.append(value)
    return cRanges
    def isIntersection(self, range1, range2):
    # Check if two ranges intersect
    return (range2[0] >= range1[0] and range2[0] = range2[0] and range1[0]

  • @mrfred456123
    @mrfred456123 Před 4 lety +4

    "Wouldn't be one of my videos if I don't mess up!!"

  • @subramanyammalepati8655

    awesome

  • @deeproy2719
    @deeproy2719 Před 2 lety

    got it after seeing it in 2nd time

  • @lettttt5557
    @lettttt5557 Před 4 lety

    ❤️❤️

  • @hannahr5037
    @hannahr5037 Před 4 lety

    reprisigning

  • @karankanojiya7672
    @karankanojiya7672 Před 2 lety

    Respect++

  • @mohammedharoon1167
    @mohammedharoon1167 Před 2 měsíci

    wow 🤩🤩🤩🤩🤩🤩🤩

  • @lugiadark21
    @lugiadark21 Před 3 lety

    Can people actually come with these solutions in a real interview without seeing this problem before lol?

  • @ps8883
    @ps8883 Před 4 lety

    Why your channel don't show how many subscribers you have?

  • @The_Promised_Neverland...

    MY CODE, ON MY OWN. kinda shitty
    class Solution {
    public:
    vector partitionLabels(string s) {
    vector res;
    int n=s.size();
    unordered_map mpp;
    for(int i=0;i