Maximum Sum of 3 Non Overlapping Subarrays | Leetcode 689

Поделиться
HTML-код
  • Опубликовано: 15 янв 2025

Комментарии • 20

  • @dhruvdangi8923
    @dhruvdangi8923 17 дней назад

    awesome solution sir

  • @thecolossalquasar5722
    @thecolossalquasar5722 18 дней назад +2

    Sir, why is the runtime so much low for your solution?

  • @VISHALMISHRA-ff2ih
    @VISHALMISHRA-ff2ih 18 дней назад +1

    What an explanation Sir🔥🔥. Question is hard due to the part of finding the path for the maximum sum.

  • @sailendrachettri8521
    @sailendrachettri8521 18 дней назад +1

    Thank you sir ;)

  • @lakithakare7387
    @lakithakare7387 18 дней назад +1

    instead of prefix sum, we can simply calculate the sum of each windows and store it, that would be simpler I beleive.

    • @techdose4u
      @techdose4u  18 дней назад

      wouldnt that be N^2 ?

    • @4nuragKr
      @4nuragKr 17 дней назад

      @@techdose4u no, O(n) only, we apply sliding window algorithm to calculate sum of windows until the last possible window for given k.

  • @taskeen_fatimaa
    @taskeen_fatimaa 18 дней назад

    Thankyou sir great explaination

  • @godFather-123-b8g
    @godFather-123-b8g 19 дней назад

    what a great explanation

  • @Abhishek-e6d2c
    @Abhishek-e6d2c 18 дней назад

    What an explanation sirji!!!

  • @swatidubey493
    @swatidubey493 19 дней назад +1

    helpful

  • @SurajSharma-ur6rm
    @SurajSharma-ur6rm 19 дней назад

    Why can't be use memo array values to find the path? If its already containing the max sum for each idx,count. Then instead of calling recursion when finding path, we can just used the memo array values right?

    • @techdose4u
      @techdose4u  18 дней назад

      Its the same logic.
      You may have to take Count = 4 in that case to cover all cases from 0 to 3.
      Your idea will work too.
      Please use table instead of calling memoization :)