Leetcode Questions & Answers Solved Step by Step | LeetCode Easy, Medium and Hard Q & A

Sdílet
Vložit
  • čas přidán 28. 08. 2024

Komentáře • 6

  • @SCALER
    @SCALER  Před 2 lety

    Got a question? Feel free to drop them in the comments below! We will make sure all your queries are answered. For more insightful videos, don't forget to subscribe to our channel. Please don't turn forget to turn on the bell 🛎 notification as well! You don't want to miss out on exclusive content. Learn more about Scaler now: bit.ly/3H8NGXI

  • @neetusingla2680
    @neetusingla2680 Před 2 lety +2

    More leetcode problems from Trees and Graphs we need

  • @NaqushabNeyazee
    @NaqushabNeyazee Před 2 lety +1

    Easier version :
    class Solution:
    def maxDistToClosest(self, seats: List[int]) -> int:
    l = -1
    ans = 0
    for i in range(len(seats)):
    if seats[i] == 1:
    if l == -1:
    ans = i
    else:
    ans = max(ans, (i-l)//2)
    l = i
    elif i == len(seats)-1 and seats[i] == 0:
    ans = max(ans, i-l)
    return ans

  • @teetanrobotics5363
    @teetanrobotics5363 Před 2 lety +1

    Time stamps are incorrect

  • @madhusingh7047
    @madhusingh7047 Před 2 lety +3

    What if we have more than 3 colours?

    • @s..2853
      @s..2853 Před 2 lety +2

      Apply count sort