Split Array Largest Sum - Leetcode 410 - Python

preview_player
Показать описание


0:00 - Read the problem
2:10 - Explain Brute Force & DP
4:32 - Memoization Code
5:10 - Explain Binary Search
12:21 - Coding Binary Search

leetcode 410

#amazon #interview #python
Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission.
Рекомендации по теме
Комментарии
Автор

Whenever Im stuck on a problem, I check if NeetCode has a solution available and like so many times before you came through. Thank you NeetCode

devdev
Автор

Neet has finally broken out of "Hard Level" brain area and breached into this new area called the "Crackhead zone". He is the first of mankind to reach this point of the brain. I have full confidence that Neet will continue such successful expeditions through the Crackhead zone as he continues to solve more cracked leetcode problems

niteshmanem
Автор

Lovely explanation as usual! You know it's an actual hard problem when the DP solution is the easiest one to come up with :p

poptart-br
Автор

Other than the weird 37 instead of 42 typo this is a spectacular explanation of the algorithm. Strongly doubt that everyone on LC who post this exact same algorithm actually thought of it themselves.

theantonlulz
Автор

In the DP approach, if you can reduce the time doing "sum(nums[i:])" to O(1) by using some technique like subtraction of two prefix sums, you can actually AC (with poor runtime)

李順安-px
Автор

the only way to guess that this is a binary search problem is that in this week leetcode has given all binary search questions🤣🤣🤣

ketangupta
Автор

binary search approach of this problem is similar to book allocation problem pattern, just in case someone is wondering about the intuition

akshitthakur
Автор

Glad you made this video. This problem is indeed Unique in Itself.

zaidshaikh
Автор

Mindbender !!! Would have never realized it is a binary search problem !!! Simply Brill 👏👏👏🙇‍♂

vdyb
Автор

I think that initializing subarray as 1 is better, since we can consider that we create an empty subarray first and then add the item into the subarray; if we initialize as 0, then you need to add 1 as the sum of last subarray is less than largest and you have to count it.

shengzhaolei
Автор

I converted that backtracking solution to a recursive function & then memoized it to make a dp solution & it worked with 10% faster & 90% space efficient. Variation of Matrix Chain Multiplication.

nishantingle
Автор

❤ Just gratitude man! Best channel ever!

vijethkashyap
Автор

was stuck on this one, thanks a lot for explaining it so well

nitaikodkani
Автор

If your code is not working then try returning low after the if else condition at last it was cut down from the video. Returning should solve your problem

mahendar
Автор

subarray + 1 <= k

This line is because our above code does not add the last subarray, which is not counted in the subarray.

vishalvanpariya
Автор

Nice video! For some moment, I came across the searching space, but stuck in the meaning of mid. Thanks for explain the mid and the greedy method.

ytsrlee
Автор

Thank you so much bro for your explanations. But with your help, I am gaining some confidence in solving hard problems.

JijaChad-osmo
Автор

Similar to "Allocate minimum number of pages" problem.

soumikkarmakar
Автор

Was waiting for this lol 100% crackhead intuition needed. Amazing explanation as always 🙌

theearthish
Автор

1. Missing return: code will not run
2. 16:06 missed the mark on explaining the logic back in 10:03

DavidDLee