Oliver and the Game | Euler Tour Concept | Graph | [CODE + Explaination] | HackerEarth | Amazon 🔥🔥
Vložit
- čas přidán 6. 09. 2024
- #graph #competitiveprogramming #coding #dsa
Hey Guys in this video I have explained with code how we can solve the problem 'Oliver and the Game'.
Code Link = ideone.com/12xDFL
Join our Telegram Channel for more Information
🔰 Telegram Channel Link = t.me/CodeLibrary1
🔰 Array question Playlist = • Love Babbar DSA 450 Qu...
🔰 String question Playlist = • Love Babbar DSA 450 Qu...
🔰 Searching and Sorting question Playlist = • Love Babbar DSA 450 Qu...
🔰 Binary Tree question Playlist = • Love Babbar DSA 450 Qu...
🔰 Dynamic Programming question Playlist = • Love Babbar DSA 450 Qu...
🔰 RoadMap of Web Development = • 🔴 Web Development Road...
🔰 Roadmap for Dynamic Programming = • Complete Roadmap for D...
🔰 Great Strategy to solve DSA = • Great Strategy to solv...
🔰 My Journey to 5 star at codechef = • My Journey to 5 Star a...
🔰 Love Babbar DSA Sheet : drive.google.c...
Follow us on Instagram:
🔰 Shailesh Yogendra : / shaileshyogendra
🔰 Yogesh Yogendra : / i_am_yogesh_here
Follow us on LinkedIn:
🔰 Yogesh Yogendra : / yogesh-yogendra-26bbb518a
🔰 Shailesh Yogendra : / shailesh-yogendra-8b13...
Hope you like it. Comment if you have any doubt
LIKE | SHARE | SUBSCRIBE
Very beautifully explained ! Thanks a lot. Keep providing the good work.
You are checking that x lies in subtree of y and y lies in subtree of x ... Both needs to be true !! This is not possible.
Even you can neglect that condition, then also soln will accept
++
Bhai tu kitna mast kaam kar raha hai👏🏼
Amazing yaar 🔥🔥salute to you👍🏻
Getting tle in last 2 cases even after using fast io?
use sacnf and printf instead of cin and cout
i literally hit the like button 10times. I wish all them were counted! You made the ques so easy. Bless you :)
i hitted like button 21 times.
It will count to 0. You should've hit it odd no. Of times. 😅😂.
Commented Just for fun. 🙂
very beautifully explained!
Sir,graph aur linked list me se pehle koi ek complete do taaki continuous flow bna rhe topic ka.Complete graph first(mostly done) then complete linked list.
Yaar galat code kyu likhte ho yaar intime out time kuch banaya he nahi aise he submit b ho gya wahh
can you tell me where is it wrong?
but why not use visited while doing dfs plz tell?
We use visited while doing DFS on graph . Because in graph , due to existence of cycle there is a possibility that we can reach a node twice . In tree, there are no cycles so we will never revisit a node . In the given question, this is a tree .
@@sujoyseal195 how can u say it will always form a tree ?
Bhaiya Apne DSA exactly konse course sei sikha tha...pls bata dijiye . Kya Aapne coding ninjas wagera Ka course kaara tha ?
bro ur this approach is partially correct it is not getting accepted tle for some test cases , i tried running your code too it fails
take input and output in C language format use scanf and printf instead of cin cout, you will get AC even hackerEarth editorial used this
ios_base::sync_with_stdio(false);
cin.tie(NULL);
add these lines in the main before taking inputs
Very good explanation brother. 1 question : how did you know in the first place that the form of connection was a tree structure like why can't we have any connection before 1 because I read the question and was not able to find it. It says unique path but does that mean a tree structure ?
Yes! In a tree every pair of node should contain exactly one path between them.
abhi to iss aproach se tle aa raha last ke do test cases me
same bhai.. kch change kiya ab tumne uske liye?
// to avoid TLE write these lines in your main()
ios::sync_with_stdio(0);
cin.tie(0);
@@shubhamsood1406 thanks brother
@@shubhamsood1406 Still I am getting TLE after adding this..
thanks bhai, this actually worked :)
When will you announce gievway results of Amazon SDE
The solution is not able to pass all the test cases .... plz look into it and pin a probable solution to this...it would save a lot of time P.S it seems there is some problem with the judge for it would pass a test case one but would show TLE the next though there is no randomness in the algo🙏.
thanks a lot
Amazing!
good
Other way is reverse the graph ..
❤️
Op bhai
Bhaiya ek baath samjha do please , kaise pata chl rha king upar hoga ques padhke toh nhi samaj aaya aesa
King ek regular house hai na kahi bhi ho skta king
it is given in ques that adress of mansion is 1
👍🏼