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
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
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
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
Can we do it without sorting ?
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?
"medium"
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
I thought I'll like this question but I'm not
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