Text Justification - Leetcode 68 - Python

Поділитися
Вставка
  • Опубліковано 23 гру 2024

КОМЕНТАРІ • 45

  • @flueesyblueesy6246
    @flueesyblueesy6246 Рік тому +25

    This question has been the bane of me for years now

    • @johnj171
      @johnj171 6 місяців тому

      😂😂😂😂its nice to know someone out there

  • @Syed_Shifat
    @Syed_Shifat Рік тому +23

    Hey Neet, I love you, man. I wish I could meet you someday. Your videos are greatly organized and so helpful.

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

    this is really good, your coding style is very easy to understand !

  • @RagingAcid
    @RagingAcid Рік тому +7

    I've been waiting for this one from you

  • @CST1992
    @CST1992 8 місяців тому +11

    I got this one in a CodeSignal assessment. Solving this PLUS 3 other (smaller) questions in a 70-minute time frame? Forget it.

  • @garth2356
    @garth2356 Рік тому +10

    They legit asked this exact same question in the coding round for DevRev and I was able to solve it!

    • @CarsMeetsBikes
      @CarsMeetsBikes Рік тому +1

      wish I saw this video before I got a problem in a coding round today. Couldn't figure out the justification part, but at least separated the words correctly

  • @hbhavsi
    @hbhavsi 2 місяці тому +1

    I solved this but mine is quite long and handles cases separately. This is very neat. On the lines of some top solutions on the Leetcode page, but those solutions are super hard to understand.

  • @VidyaBhandary
    @VidyaBhandary Рік тому +2

    Finally!!! Thank you. Needed this one.

  • @MP-ny3ep
    @MP-ny3ep Рік тому +4

    Thank you so much for the daily problems

  • @kidscodera3043
    @kidscodera3043 10 місяців тому

    very useful video ,thanks for amazing explaination . Can you please tell me where is this mention that there has to be space between 2 consecutive words in the line. Like in example 3 : line#3 has the word enough which can be fir easily in the line#2 if we don't keep space in between two words.Please tell me if I have misinterpreted the question ,because I can not find any such restriction in question where it says that there has to be a space in between consecutive words.On the other hand , it clearly mentions that " each line has exactly maxWidth characters ", see question is only talking about characters , no constraints given about compulsary word prefix/suffix . Please help

  • @aadil4236
    @aadil4236 Рік тому +3

    The Problem was good. It imporves your thinking. Can you share more problem like these? Thanks for the explanation!

    • @NeetCodeIO
      @NeetCodeIO  Рік тому +4

      Yeah I really enjoyed it. I don't remember many like this tbh, but if anyone else does feel free to mention them here.

    • @isaiahr7041
      @isaiahr7041 Рік тому

      When you say "It improves your thinking", does this specific problem benefit you in coming up with more efficient and elegant approaches, especially with to string related problems? Even though many LC problems can enhance your problem-solving skills, does this specific one opens up to newer techniques you could use based upon what you have said?

  • @impatientgaming9868
    @impatientgaming9868 8 місяців тому +2

    Had to rewatch once but good explanation.

  • @chirpy7961
    @chirpy7961 Рік тому

    Is the space complexity of this is o(n) where n is the number of words for each line....? please correct me if I'm wrong....

  • @vinleous
    @vinleous Рік тому

    Thanks for uploading the dailies again!

  • @shawnzhang528
    @shawnzhang528 Рік тому +1

    So elegant answer

  • @anuragchoudhury365
    @anuragchoudhury365 Рік тому

    I have a question at line #27. In case the line contains one word with exactly the same number of characters as maxWidth, won't the last line contain maxWidth + 1 characters? Why is it not giving an error for exceeding the maxWidth. I'm not familiar with Python so if you/someone can help me understand this.

    • @ArgonautJasonLoL
      @ArgonautJasonLoL Рік тому

      It won't because #27 is the delimiter is what is put between words in this case. If there is only one word, then no delimiters are added.

  • @uptwist2260
    @uptwist2260 Рік тому +1

    Thanks for the daily

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

    Thanks Neet!

  • @mortal_coder4869
    @mortal_coder4869 Рік тому

    Great Coding there, thank you!

  • @ruthlessogre2441
    @ruthlessogre2441 Рік тому +5

    This was one of the easiest hard questions.

    • @Benstokes555
      @Benstokes555 7 місяців тому

      yes but the edge cases are pretty confusing. therre isnt much logic to be applied in this.

  • @ManishKumar-zt5sk
    @ManishKumar-zt5sk 3 місяці тому

    saw your video and wrote the code in C++, ACC in 1st attempt

  • @ax5344
    @ax5344 9 місяців тому

    I tried to find python solution of this problem from your website, but it is not there. Could you verify?

  • @AlexErmashev
    @AlexErmashev 10 місяців тому

    How long did it take you to solve it?

    • @ryanrenjith3504
      @ryanrenjith3504 6 місяців тому

      took me 1.5 hrs grinding it with a pen and paper

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

    thanks for the video

  • @ThefactMaster01
    @ThefactMaster01 Рік тому

    Amazing explanation.

  • @KaranVerma-pf5jw
    @KaranVerma-pf5jw 8 днів тому

    Does anybody watching this video calculated the time and space complexity , I think T.C is O(N^2) where N is the length of words , where max N = 300 and space complexity O(maxWidth)

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

    This in itself is a microservice for sure.

  • @Benstokes555
    @Benstokes555 7 місяців тому +2

    saaari duniya see jeeth ke me aaya hu idhar🤓🤓

  • @SrinivasNarayanamrocks
    @SrinivasNarayanamrocks 7 місяців тому

    you missed a case to handle the single word sentences which is not the last sentence: if len(line) == 1: line[0] += ' ' * extra_space this line would come in around line 13 of your code

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

    im bouta crash out

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

    i copied the exact solution and still it shows error

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

    It’s starting to make me feel a bit dumb when everyone keeps saying it’s easy.

  • @classicmakersmusic6344
    @classicmakersmusic6344 10 днів тому +1

    This is an impossible problem

  • @metarus208
    @metarus208 Рік тому

    need mmmmmooorre