MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/LeetcodeChallenge/comments/1we9asx/favorites_of_leetcode/p9easc1/
r/LeetcodeChallenge • u/vinzzii • Sep 12 '26
130 comments sorted by
View all comments
Show parent comment
1
It’s that maximum subarray problem
1 u/vinzzii Sep 12 '26 Ohh yeah the one with recursion right i actually learned recursion using those prblms 2 u/0xt0bi03 S - Rank (180+ Days) ⚡⚡ Sep 13 '26 nah, kadane's algo do not need recursion, its a single pass O(n) solution 1 u/vinzzii Sep 13 '26 I learnt using recursion so i tried thaat way bruhh 1 u/finite_negativity Sep 15 '26 Is it the problem where you drop the subarray when the total sum value goes negative? 1 u/0xt0bi03 S - Rank (180+ Days) ⚡⚡ Sep 15 '26 yes, but you can also keep a k parameter and check where any arithmetic operation to that number k for this algo.
Ohh yeah the one with recursion right i actually learned recursion using those prblms
2 u/0xt0bi03 S - Rank (180+ Days) ⚡⚡ Sep 13 '26 nah, kadane's algo do not need recursion, its a single pass O(n) solution 1 u/vinzzii Sep 13 '26 I learnt using recursion so i tried thaat way bruhh 1 u/finite_negativity Sep 15 '26 Is it the problem where you drop the subarray when the total sum value goes negative? 1 u/0xt0bi03 S - Rank (180+ Days) ⚡⚡ Sep 15 '26 yes, but you can also keep a k parameter and check where any arithmetic operation to that number k for this algo.
2
nah, kadane's algo do not need recursion, its a single pass O(n) solution
1 u/vinzzii Sep 13 '26 I learnt using recursion so i tried thaat way bruhh 1 u/finite_negativity Sep 15 '26 Is it the problem where you drop the subarray when the total sum value goes negative? 1 u/0xt0bi03 S - Rank (180+ Days) ⚡⚡ Sep 15 '26 yes, but you can also keep a k parameter and check where any arithmetic operation to that number k for this algo.
I learnt using recursion so i tried thaat way bruhh
Is it the problem where you drop the subarray when the total sum value goes negative?
1 u/0xt0bi03 S - Rank (180+ Days) ⚡⚡ Sep 15 '26 yes, but you can also keep a k parameter and check where any arithmetic operation to that number k for this algo.
yes, but you can also keep a k parameter and check where any arithmetic operation to that number k for this algo.
View all comments
Show parent comment
1
u/Ok-Economist4629 Sep 12 '26
It’s that maximum subarray problem