Largest Submatrix With Rearrangements - Leetcode 1727 - Python
Vložit
- čas přidán 5. 07. 2024
- 🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🧑💼 LinkedIn: / navdeep-singh-3aaa14161
🥷 Discord: / discord
🐦 Twitter: / neetcode1
🐮 Support the channel: / neetcode
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
Problem Link: leetcode.com/problems/largest...
0:00 - Read the problem
1:37 - Drawing Explanation
9:30 - Algorithm walk through
12:25 - Coding Explanation
leetcode 1727
#neetcode #leetcode #python
Did you solve this without hints ? Seems like a super tough problem and none of the solution was intuitive
Just to get this intuition from the code would have been hard, let alone explaining it. Thank god you're back lol
hardest medium on LC
Man im glad i'm not the only one who felt this way. I was on a streak of 7 days but then came upon this problem which felt hard af
literally same exact position. 7 day streak and this one killed my confidence.@@Moch117
The matrix intuition threw me for a loop so far the only one to explain the bxh res calculation, thanks!
Its definitely not a medium level question
yeah
Yeah I thought it was pretty hard for medium
Can we do it without sorting ?
Without sorting:
Time: O(n*m), Space: O(m)
n, m = len(matrix), len(matrix[0])
result = 0
towers = list(map(lambda x: (x, 0), range(m)))
for i in range(n):
new_towers = []
zeros = []
for j, height in towers:
if matrix[i][j]:
new_towers.append((j, height + 1))
else:
zeros.append((j, 0))
towers = new_towers + zeros
for j in range(m):
result = max(result, (j + 1) * towers[j][1])
return result
Nice
what does Neetcode think of copycat youtubers who copy your video thumbnail style for clickbait :')
happens so often, I look forward to Neetcode videos, click on it and I start hearing someone else's voice
Yeah I've noticed a lot of those lately
"medium"
I needed something like this for my quant internship
Do you mean it came up in the interview, or you actually had to do this for a real-world problem?
Knight Dialer pls
Coming in 30min
The code is good but the explanation has lots of gaps and mistakes
Within One Year i will make a huge salary hike in my career dsa will be one of my areas on focus
And topics like HLD and LLD are also important
I thought I'll like this question but I'm not