2097. Valid Arrangement of Pairs | No Pre-requisite | Eulerian Path | DFS

  Рет қаралды 1,358

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 10
@niravrathod1146
@niravrathod1146 2 күн бұрын
Best explanation on post order DFS :)
@codingedtech
@codingedtech Күн бұрын
Good to see simple dfs intuition in this video which i were looking, but i have one doubt doubt:- at 23:04 in video how simple dfs will get (2, 1) pair along with (1, 2) as he got in first. we mark 1 as visited in simple dfs and then move it's nbr( which is 2) then now we will do dfs from 2 and move to it's nbr(which is 1 and visited) then we will not be getting.
@rajrajesh1669
@rajrajesh1669 2 күн бұрын
This problem literally questioned my skills 😢. Usually, I'll try to avoid incorrect approaches by validating my thoughts but however for this problem I thought it's actually an easy-hard one, by assuming that each node will only have one edge, so I directly jumped to write an O(n) hash solution without DFS but after submission I realised the mistake. Then even though I know just a blind DFS from every starting point will not solve the problem due to the constraints, I wanted to just code it then if I get a TLE then I thought I'll read leetcode editorials for efficient solution if it's not enough then watch your video editorial. But there was yet another problem, I misjudged it again because I missed the backtracking part. After covering that part I again failed not by TLE but with my DFS itself, I spent about 2hrs just to debug and figure out what went wrong. After going through all these, I finally decided to give up and here I am. Basically, I went through every single wrong direction you explained, lol. No one can explain a solution with this level of care and effort, that's why you are the best. Thanks again for the wonderful editorial, Aryan bro. Finally, inner peace.❤
@nikhilprakash729
@nikhilprakash729 Күн бұрын
Awesome Explanation Bhaiya
@kbcoder3734
@kbcoder3734 2 күн бұрын
Really Nice Solution, one improvement could be using the vector ans to store the answer in the dfs, So that at the end we don't need to convert the result to the required format again.
@shadyboy3010
@shadyboy3010 2 күн бұрын
nicely explained, thanks man
@Its_Shubham_Negi
@Its_Shubham_Negi 2 күн бұрын
Finally c++❤
@priyanshupriyam174
@priyanshupriyam174 Күн бұрын
I am only believe on Aryan bhai because game changer person there is only one that is the Aryan Mittal!
@bishwashkumarsah171
@bishwashkumarsah171 2 күн бұрын
11:32 lol i was exactly thinking about this and wanted to take that case as input. haha
@josephsamuelm4608
@josephsamuelm4608 Күн бұрын
One doubt : At 28:02 how are we making sure that 1,3 is at the end, just by post order traversal? What if the adjacency list is 1->2,3,4 and 2->1 and 4->1 then 1,3 won't be coming first in the post order traversal right. It will be 1,4 that comes first, right?
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 19 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 255 МЛН
The Best Way to Learn Linux
9:45
Mental Outlaw
Рет қаралды 149 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
💥ФЕЙГІН повернувся із СУДЖИ і шокував заявою
36:27
Телеканал Прямий
Рет қаралды 169 М.
Valid Arrangement of Pairs | Leetcode 2097
30:26
Techdose
Рет қаралды 4,2 М.
Dr Gabor Mate answers question about October 7th during conference
12:53
Middle East Eye
Рет қаралды 576 М.
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 19 МЛН