that diagonal check using absolute value of previous and current row/column was mindblowing...O(1)
@amandixit83422 жыл бұрын
yeah beacause ek hi loop mein teeno possiblities check kar de raha , jab mene ye dekha 2-3 friends ko aur batya dekh bhai aise b ho skata no need to 3 loop for checking , it's really good approach :)
@harshupreti15262 жыл бұрын
Yes checking of the slope
@soumyadeepdash48052 жыл бұрын
You can also do the whole check function in O(1) using three arrays, 1st array is to check whether we can place the queen in this column, 2nd one is for left diagonal and 3rd is for right diagonal. Indexing of left diagonal => n-row+col,,,, right diagonal => (2*n-1)-row-col. Also u have to update these arrays when placing queens.
@vivekgupta3484 Жыл бұрын
@@soumyadeepdash4805 True. infact even faster approaches exist like keeping this diagonals in bitmask and taking & to find possible positions in O(1) ... thats even faster... but let's keep things to limit for now.
@radicalengineer23312 жыл бұрын
This is one of the most optimal ways to solve with a framework bhai ko as if pata hai ki exactly kidhar we'll get stuck and he has shown us the way to think on that using his LCCM method Super bhai
@utkarshpandey66006 ай бұрын
diagonal trick is came from mathematiics slope formula, as we know diagonal are at an angle of 45 degree , so tan 45 is 1. then our formula will become like that condition
@AmanTheMystery2 жыл бұрын
that diagonal check trick is awesome....that why if some one knows recursion still i said to watch vivek sir videos u will get new things in your bag
@CodeChamp-tw8ho3 ай бұрын
great problems and a lot to learn!!💻💻
@anjumankhan15932 жыл бұрын
Super easy to understand with LCCM method!!!
@CREATIONTIME17 ай бұрын
why this video is not getting millions views.. this is the best explanation..
@abhishek042042 жыл бұрын
dont know how you manage the recording and your job thank you for the videos
@Sandeep-zd6dq2 жыл бұрын
Loved this video, specially the check to place the queen till now I was always writing 3 loops in my check function 😂
@akshatmehra39512 жыл бұрын
Maze aa gye bro 🔥N-Queens ekdum samajh aa gya. Thanks a lot for the good work, keep it up 👍🏼 full support
@socify44106 ай бұрын
absolute mindblowing
@leftover192 жыл бұрын
Hii sir, my friend gave me your algozenith course and another friend (6* on codechef) told me to learn dp from here. When I heard your voice i was like 🤯🤯 this man. All I want to say is your explanation is very elaborate and easy to understand. Never understood dp this way. Thanks for the effort.,❤️
@noone09785 ай бұрын
note for me: see, the approach i can think for last problem is that we will declare penalty as global variable starting from zero, then we will write the rec function with level starting from zero and going till n and we will declare n as k+1, we will also make an array of size k+1 which will store the area of each part because k tear will result in k+1 parts, when the base case will hit that is level==n, then we will find penalty=min(penalty, current penalty) where current penalty will be sum of square of elements of array, now for the tear part that how we will tear, what i thought was we will use two recursion loops, one will tear horizontally and other will tear vertically this is not complete but this was my first thought hit in 2 minutes after seeing the problem
@Sandeep-zd6dq2 жыл бұрын
Bro ye shi tarika hai video ko question k saath end krne ka 😂 ab ruka hi nhi jaa rha isko solve toh krke rahunga 😎 because it’s a new question for me 🔥
@AshishKumar-cw9xw Жыл бұрын
Can u please send the solution of last problem
@AdityaPradhan-f2p4 ай бұрын
24:05 Wow!
@smile_please58482 жыл бұрын
can anyone explain what we are doing at 22:49 ,how we are saving the position of previous queens?
@vivekgupta34842 жыл бұрын
the queens array is global and is being shared across … and in recursion it is being filled
@sachitsankhe51022 жыл бұрын
Amazing Day-1
@saranghae37202 жыл бұрын
last problem is based on dp on partition, as we can cut at any co-ordinate of the grid. Correct me, If I'm wrong.
@akshayshah70082 жыл бұрын
Hey Vivek, Everytime writing the base case first is necessary or how do you think when it comes to base cases?
@ArnabJhaYT2 жыл бұрын
very beautiful code
@shriyanshjain44442 жыл бұрын
33:18 I understand the logic explained but line 38 and 40 inside if check confuses me still. Can anyone help?
@abhishekc35562 жыл бұрын
Line 38 is suppose if you've placed a queen at the current level / row you're at, then you do rec(level + 1) meaning after you've placed the queen at current row, you're asking the recursion to go to the next level / row and place queens there if possible. Line 40 is suppose you have a 8*8 board and you place a queen on the 0,0 coordinate. Assume the total number of possible configurations is x if you've placed the queen on the 0,0 coordinate. Now the question wants you to compute the total number of cases right. So now you'll place a queen on 0,1 coordinate and try to find all possible configurations but before you place a queen on 0,1 you need to remove the queen you had placed on 0,0. That's why on line 40 we remove the queen that was previously placed
@abhishekc35562 жыл бұрын
I'd recommend to go through striver's recursion playlist. He's explained recursion beautifully
@MCAAARULMishra2 жыл бұрын
@@abhishekc3556 can you please explain why he said LINE40 is not need for this problem at 26:34
@shriyanshjain44442 жыл бұрын
@@abhishekc3556 sure will check that
@abhishekc35562 жыл бұрын
@@MCAAARULMishra just watch takeUForward's nqueen problem once and even then if you don't understand, I'll explain.
@AKASHKUMAR-li7li8 күн бұрын
in que 3 why we have not taken the values itemTaken and timeTaken along with recursive calls.....?
@Profnegi10 ай бұрын
N-queen best: i've done this by myself after watching the video (in leetcode there is more on this problem )
@utkarshpandey66006 ай бұрын
i 3rd question , how ans will return our real maximum skill, in whole code we do not did anything to it. and how answer return.
@vivekgupta34846 ай бұрын
Time stamp exactly?
@noone09785 ай бұрын
in 3rd problem that skill one, you didn't used loop, but can we iterate over all n and then check if it satisfies or not instead of using 2 recursive calls, like one for loop and one recursive call inside that for loop?
@Abhishek-fo3fc2 жыл бұрын
DAY 1 PART 2 DONE
@dharsan.s79372 жыл бұрын
Solved all the practice problems
@AshishKumar-cw9xw Жыл бұрын
Can you please send the last problem solution
@Dr.dhumketuIITDholakpur7 ай бұрын
can you please send link of last question that X time and K problem one
@priyojitghosh3672 Жыл бұрын
not able to open the question link
@vivekgupta3484 Жыл бұрын
Make sure to signup on learning.algozenith.com
@abhi_31582 жыл бұрын
bhaiya can u decrease the font of the code so that we can see the all the code of one function in one time so that we can get the intution of the function more easily.Overall your content is amazing.
@ZSTAR_CODE18 күн бұрын
NQueen backtracking 20:00
@hello-sb7zj2 жыл бұрын
Can anyone tell what is the time complexity of example 3
@vivekgupta34842 жыл бұрын
Let's discuss time complexity in today's Live class.
@hello-sb7zj2 жыл бұрын
@@vivekgupta3484 ok sir
@PrasadTGS Жыл бұрын
Is it possible to watch the live class now @@vivekgupta3484
@codemode29252 жыл бұрын
need some more calrity on the reverting the choices part.
@abc-ym4zs Жыл бұрын
bhaiya i dont why i am afraid of doing new things how to comeout of this way
@PrasadTGS Жыл бұрын
why did we take queens array size as 20 , dont it effect in case of large board
@SRoy27002 ай бұрын
yes if the board size is > 20 *20 then it would definitely
@jayantgupta5310 Жыл бұрын
Problems page is showing error 404 not found
@vivekgupta348410 ай бұрын
sorted now
@niveditashukla29012 жыл бұрын
bhaiya, I solved this count number of ways to climb stairs on an online coding platform but it showed TLE for some test cases!
@vivekgupta34842 жыл бұрын
Great … check comments … not everything is DP ;P
@akshatsinghtomar9207 Жыл бұрын
Isn't 3rd question a greedy problem?
@nitinchoudhary51832 жыл бұрын
could you please help to model “find all substrings of a input string” in level , choice , check , move framework
@vivekgupta34842 жыл бұрын
Do you mean distinct substring? that is a from 2 problem ... we will discuss it don't worry.
@sababmuhammad4842 Жыл бұрын
understood
@nikhilkumarv25772 жыл бұрын
🛐
@yashmohta6420 Жыл бұрын
Bhaiya problem link is not working ,please do something about it.
@vivekgupta348410 ай бұрын
sorted now
@Sandeep-zd6dq2 жыл бұрын
In skill problem can we avoid that check if we keep timeTaken and itemTaken in our recursion states ??? Although not sure🤔 But this check enforce us to follow this structure 🙌
@vivekgupta34842 жыл бұрын
Correct.. that's what we are actually gonna do ! Great observation.
@rachakondaeshwar41296 ай бұрын
N queen is now easy
@aryanbarnwal5645 Жыл бұрын
problem link not working
@vivekgupta348410 ай бұрын
new course added
@shivankkunwar96692 жыл бұрын
the videos are great but the algozenith platform is impossible to write code in java worst experience .
@vivekgupta34842 жыл бұрын
you are supposed to write in your own pc .. test and paste
@shivankkunwar96692 жыл бұрын
@@vivekgupta3484 💁💁💁💁
@AmanChauhan-hr1wh2 жыл бұрын
ans=0 then ans+=...is confusing can anyone explain that part plss
@hritikrawat64522 жыл бұрын
May I know how we can verify 92 moves answer is correct or not?
@vivekgupta34842 жыл бұрын
Because i got the same :D
@enigmanarratives12 жыл бұрын
how much tym will it take when i will be able to solve leetcode medium fast and without liiking solution i am 90 at leetcode
@vivekgupta34842 жыл бұрын
300 - 400 problems
@ashokcherry80152 жыл бұрын
I am from banglore
@ashokcherry80152 жыл бұрын
Bhaiyya meet up
@vivekgupta34842 жыл бұрын
Neend hi muskil se ho rhi hai kabhi kabhi... thoda aur ruk jao... par pakka karenge.
@jivanninawe31902 жыл бұрын
Bhai hindhi may banaho video
@DPCODE722 жыл бұрын
Heyyyy bro....small advice go with Hindi language!!