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

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

Aryan Mittal

Aryan Mittal

Күн бұрын

Пікірлер: 11
@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.
@niravrathod1146
@niravrathod1146 Ай бұрын
Best explanation on post order DFS :)
@rajrajesh1669
@rajrajesh1669 Ай бұрын
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.❤
@bishwashkumarsah171
@bishwashkumarsah171 Ай бұрын
11:32 lol i was exactly thinking about this and wanted to take that case as input. haha
@priyanshupriyam174
@priyanshupriyam174 Ай бұрын
I am only believe on Aryan bhai because game changer person there is only one that is the Aryan Mittal!
@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?
@SelvaArumugam-xq5mf
@SelvaArumugam-xq5mf Ай бұрын
Yeah i get the same doubt plz explain it... what happens if the end comes in the middle traversal then even reversing it does make it to come to the last ryt
@kbcoder3734
@kbcoder3734 Ай бұрын
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.
@nikhilprakash729
@nikhilprakash729 Ай бұрын
Awesome Explanation Bhaiya
@shadyboy3010
@shadyboy3010 Ай бұрын
nicely explained, thanks man
@Its_Shubham_Negi
@Its_Shubham_Negi Ай бұрын
Finally c++❤
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Programming Is Cooked
9:30
ThePrimeTime
Рет қаралды 363 М.
The Biggest React Framework You've Never Heard of
20:29
Theo - t3․gg
Рет қаралды 52 М.
COMPUTER SCIENCE explained in 17 Minutes
16:49
Wacky Science
Рет қаралды 1,8 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41