Largest Submatrix With Rearrangements - Leetcode 1727 - Python

Sdílet
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

Komentáře • 23

  • @Moch117
    @Moch117 Před 7 měsíci +17

    Did you solve this without hints ? Seems like a super tough problem and none of the solution was intuitive

  • @gmh14
    @gmh14 Před 7 měsíci +9

    Just to get this intuition from the code would have been hard, let alone explaining it. Thank god you're back lol

  • @shoooozzzz
    @shoooozzzz Před 7 měsíci +10

    hardest medium on LC

    • @Moch117
      @Moch117 Před 7 měsíci +5

      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

    • @julianelmasry9556
      @julianelmasry9556 Před 7 měsíci

      literally same exact position. 7 day streak and this one killed my confidence.@@Moch117

  • @TheFast900
    @TheFast900 Před 7 měsíci

    The matrix intuition threw me for a loop so far the only one to explain the bxh res calculation, thanks!

  • @mindhealer6163
    @mindhealer6163 Před 7 měsíci +7

    Its definitely not a medium level question

  • @swastikgorai2332
    @swastikgorai2332 Před 7 měsíci

    Can we do it without sorting ?

  • @arihantbedagkar7678
    @arihantbedagkar7678 Před 7 měsíci +1

    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

  • @broccoli322
    @broccoli322 Před 7 měsíci

    Nice

  • @user-j5ja95
    @user-j5ja95 Před 7 měsíci +3

    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

    • @NeetCodeIO
      @NeetCodeIO  Před 7 měsíci +1

      Yeah I've noticed a lot of those lately

  • @sk_4142
    @sk_4142 Před 7 měsíci +2

    "medium"

  • @CS_n00b
    @CS_n00b Před 7 měsíci

    I needed something like this for my quant internship

    • @hamirmahal
      @hamirmahal Před 7 měsíci +2

      Do you mean it came up in the interview, or you actually had to do this for a real-world problem?

  • @yang5843
    @yang5843 Před 7 měsíci

    Knight Dialer pls

  • @PoRBvG
    @PoRBvG Před 2 měsíci

    The code is good but the explanation has lots of gaps and mistakes

  • @VIJAY-hg7ei
    @VIJAY-hg7ei Před 7 měsíci +1

    Within One Year i will make a huge salary hike in my career dsa will be one of my areas on focus

    • @JohnSnow-gi7iv
      @JohnSnow-gi7iv Před 7 měsíci +1

      And topics like HLD and LLD are also important

  • @ronbuchanan5432
    @ronbuchanan5432 Před 3 měsíci

    I thought I'll like this question but I'm not