Your observation of how to check the vacant positive/negative diagonal cells is brilliant
@arjunverma750
2 жыл бұрын
Thanks!
@stacysealkylee6676
2 жыл бұрын
Just want to thank you for making these vidoes! You are awesome and helping a ton of people !!
@vasujain1970
2 жыл бұрын
Appreciate the consistent vids. Also, this is just what I needed for the daily challenge! :P
@Raymond-Wu
2 жыл бұрын
That nonlocal keyword was exactly what I was looking for! I had thought it was global. I ended up just creating the count upon initialization.
@yaswanthkosuru
2 жыл бұрын
u can use self.res
@李建宏-c6y
Жыл бұрын
You make this problem super easy! Thanks!
@orellavie6233
2 жыл бұрын
What is the difference between the queen 1 sol? It is exactly this one, besides counting instead of returning a one sol. So the time complexity is the same approximately
@kasivisu3109
2 жыл бұрын
Hi, I really like the way you describe the problem and solution. The conditions in the back track function should be or instead of and condition. Thanks a lot Man!!
@TechOnScreen
2 жыл бұрын
you are a genius..
@derpy566
24 күн бұрын
We can ignore rows because of pigeonhole principle, each row must have a queen. If there are n - 1 rows and we have n queens then it is impossible to have a solution. I think this is the best way to explain it
@oneepicsaxguy6067
8 ай бұрын
A lot of the times the board is identical if you rotate it by 180 degrees, which means you can cut the running time by almost half doing this optimization. This is easier to do when only number of possible orientations are asked, and I guess this is why this question is called n-queens 2. Maybe you could make a video with the optimization later. You can still do an optimization in the original n-queen but it is much much harder to do.
@kanishkkala16
7 ай бұрын
i copy pasted n-queens and returned len(res) and well it worked , hahah :)
@youngtraveler2799
11 ай бұрын
N-Queens: The problem - HARD level => NeetCode: its a easy problem N-Queens II: supposed to be harder that the first one => NeetCode: its easier than the first N-Queens
@itsrdb
2 жыл бұрын
Hi there! absolutely love your explanations, could you please make an explanation video on 164 Maximum Gap which uses Radix/Bucket sort? Thank you
@melissac4872
2 жыл бұрын
What would be a better way for Python(not python3) to deal with the non-local variable WITHOUT creating a list and returning the len(list)?
@oogieboogie7028
Жыл бұрын
count = [0] count[0] +=1 return count[0]
@chrisgalanis1930
2 жыл бұрын
Hey, Great video. It was very helpful. Can I ask you what software do you use for the pen?
@NeetCode
2 жыл бұрын
Thanks, I use Paint3D with a mouse
@benjaminkeene5444
2 жыл бұрын
Hey hey! I think you reversed posDiag and negDiag set calculation. It doesn’t affect it as long as you keep it consistent (which you did). posDiag should be (r-c), such as 0-0, 1-1, 2-2, which all equal 0. negDiag should be (r+c), such as 3+0, 2+1, 1+2, which all equal 3.
@tlz124
2 ай бұрын
In problem 51, he explained why he refers to the positive and negative diagonals that way. Like you said though, either way works as long as it's consistent
@ishanmamadapur6307
2 жыл бұрын
How does the code identify different solutions, so when we use backtrack, we can come up with one working solution, how can we continue from the start after finding one working result?
@azharabdurrasyid680
2 жыл бұрын
There are 2 things that make the algo continue to find other result 1. The backtrack function called inside the for loop. So even though the solution is found, it'll still try to place the queen in the next column 2. The set is "reseted" after the backtrack function is called
@CS_n00b
2 жыл бұрын
Hey neetcode, do you think you could have a go at 1105 filling bookcase shelves? thanks
@naturesrevolution
Ай бұрын
anyone kindly answer what is the difference between queen 1 and queen 2 problem?
@abhishaiwinston9794
2 жыл бұрын
Could you please do "sudoku solver" next?
@kneeyaa
2 жыл бұрын
+1
@Adarsh-mn7pl
2 жыл бұрын
he has done already
@kneeyaa
2 жыл бұрын
@@Adarsh-mn7pl he has done valid sudoku not sudoku solver
@qihse1531
Жыл бұрын
+1
@melissac4872
2 жыл бұрын
Leetcode doesn't accept nonlocal variables for python. It seems like it only works for python3
@_XY_
2 жыл бұрын
You Genius 👏
@thesouthsidedev1812
2 жыл бұрын
what app are you use for drawing over?
@CostaKazistov
2 жыл бұрын
From memory, in one of the old video comments he answered this question: Microsoft Whiteboard
@thesouthsidedev1812
2 жыл бұрын
@@CostaKazistov thanks I haven't seen that one
@shriharikulkarni3986
2 жыл бұрын
Hi neet, can you pls solve the skyline problem
@mehvashkhan8786
2 жыл бұрын
can someone please explain me that how would the res pointer increment each time as a solution is found as the pointer is written to be incremented only when r==n, so that must be only for once then right? please guide me through
@azharabdurrasyid680
2 жыл бұрын
r==n means that all the queens are placed for each row in other words a solution is found. U have to realize that r starts at 0. For example if N=4, when r = 1 means a queen have been placed in row 0. r = 2 means a queen have been placed in row 0 and 1 r = 3, queen have been placed in row 0,1,2 r = 4 = N, queen have been placed in row 0,1,2,3 (all row)
@mehvashkhan8786
2 жыл бұрын
@@azharabdurrasyid680 ThankYou!! :)
@hsakaardnetih7898
2 жыл бұрын
sorry if this is a stupoid question but how does r increment?
@deeppsy
2 жыл бұрын
Line 20: backtrack(r+1) He calls backtrack with an incremented version of r
@hsakaardnetih7898
2 жыл бұрын
@@deeppsy thanks. i got it
@lalitvinde1441
2 жыл бұрын
Plzz man make video on leetcode-542 , TBH i love and understand ur way of logical explanation with in a minutes, most of KZitemr make long brain fucking videos man 😭😭
@masternobody1896
2 жыл бұрын
Nice
@sharathkumar8338
2 жыл бұрын
Hello I have a strong negative feeling that even though I crack FAANG i'm not able to do work well in the company. Because my current role is testing and I'm good at DSA and system design but apart from that I don't know anything. Because of this fear I rejected Juspay and indian startup offer and made my manager to give me hike fearing that they might expect me to work quickly etc. and also I didn't study in good colleges and my college grades aren't that good. Can anyone answer to my query?? it would be really helpful for me.
@roopchandjangir6862
2 жыл бұрын
Bhai jese jese age jaega vese vese path clear ho jaega, sb sikh jaega apne ap
@sharathkumar8338
2 жыл бұрын
@@roopchandjangir6862 Thank you bhai.
@icephoenix3565
2 жыл бұрын
Just stay where you are Kumar, not everyone needs to get into faang to feel fulfilled.
Пікірлер: 51