Reconstruct Itinerary | LeetCode 332 | C++, Java, Python

preview_player
Показать описание

**** Best Books For Data Structures & Algorithms for Interviews:**********
*****************************************************************************

June LeetCoding Challenge | Problem 28 | Reconstruct Itinerary | 28 June,
Facebook Coding Interview question,
google coding interview question,
leetcode,
Reconstruct Itinerary,
Reconstruct Itinerary c++,
Reconstruct Itinerary Java,
Reconstruct Itinerary python,
Reconstruct Itinerary solution,
332. Reconstruct Itinerary,

#Facebook #CodingInterview #LeetCode #JuneLeetCodingChallenge #Google #Amazon #DFS
Рекомендации по теме
Комментарии
Автор

Great video.
Thanks a lot for making such videos.
Precious content

paragroy
Автор

16:00 swap XYZ with YXZ in this example.... if we take XYZ from JFK it ends there. No path from XYZ to JFK

jaimingandhi
Автор

@knowledge center


What is time complexity of this solution?
Is it O(nodes* log(edge) + nodes)

Where nodes is for pushing into result and reversing them
And edges is for putting into multimap

TechWithKomal
Автор

please answer @Ash winchester 's comment on the intuition of how your code is working for dead end vertices..
I mean your code is absolutely nice, but please provide the intuition of how it gets the work done for 2 odd vertex Eulerian paths
ex: [["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]]

rohitvarma
Автор

Thats amazing. I had a very similar solution but it was failing for a test case and I do not understand why. The test case is with a dead end. Why is your solution working, when there is a dead end?

E.g. we have [["JFK", "KUL"], ["JFK", "NRT"], ["NRT", "JFK"]].
Then you are going from JFK to KUL (because KUL < NRT). Then you are stuck in KUL. Why isnt that happening to your solution?

cloud
Автор

Amazing solution! I did not know about multiset and used vector<string> instead, then used for loop again to sort every vectors stored inside the key. The way you use backtracking in dfs loops much like stack as you explained before. BTW thanks for taking my feedback and updating the playlist!

MrSun
Автор

At first, I thought this is the question of Euler path, but it was much simpler than that. THANKYOU SIR !!

mukultaneja
Автор

You are amazing!! Always covers those minute details. I also like the transitions in your explanation. Few Instances are "Starts with a set and then shifts to multiset" or "starting with a stack and then gradually shifting to reversing result vector".

surajkiranreddymothe
Автор

*Better use backtracking, deleting edge in every dfs call is costly* :)

subham-raj
Автор

why have you written string v = *(adj...);
why have you used *

shivanktripathi
Автор

DId not understood the use of multiset

sanjivtripathi
Автор

What's the level of this question sir? Easy, medium or hard

arudhranarasimhan
join shbcf.ru