Oliver and the Game | Euler Tour Concept | Graph | [CODE + Explaination] | HackerEarth | Amazon 🔥🔥

Sdílet
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

Komentáře • 44

  • @aritralahiri8321
    @aritralahiri8321 Před 3 lety +5

    Very beautifully explained ! Thanks a lot. Keep providing the good work.

  • @renishabhuva7928
    @renishabhuva7928 Před 2 lety +1

    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

  • @raviashwin1157
    @raviashwin1157 Před 3 lety +2

    Bhai tu kitna mast kaam kar raha hai👏🏼

  • @itsjaypatel
    @itsjaypatel Před 3 lety +1

    Amazing yaar 🔥🔥salute to you👍🏻

  • @snehabaser3155
    @snehabaser3155 Před 3 lety +3

    Getting tle in last 2 cases even after using fast io?

  • @shreyasri4774
    @shreyasri4774 Před 2 lety +11

    i literally hit the like button 10times. I wish all them were counted! You made the ques so easy. Bless you :)

    • @AllRounder-jt1pe
      @AllRounder-jt1pe Před 2 lety +1

      i hitted like button 21 times.

    • @tusharpathade2557
      @tusharpathade2557 Před 2 lety +2

      It will count to 0. You should've hit it odd no. Of times. 😅😂.
      Commented Just for fun. 🙂

  • @krishnapalpanwar8280
    @krishnapalpanwar8280 Před 2 lety

    very beautifully explained!

  • @ankushsharma1772
    @ankushsharma1772 Před 3 lety +1

    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.

  • @sanjayyadav-vu3cd
    @sanjayyadav-vu3cd Před 3 měsíci +1

    Yaar galat code kyu likhte ho yaar intime out time kuch banaya he nahi aise he submit b ho gya wahh

  • @Raghav_362
    @Raghav_362 Před 3 lety +2

    but why not use visited while doing dfs plz tell?

    • @sujoyseal195
      @sujoyseal195 Před 2 lety

      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 .

    • @ANKITCHAUHAN-do2ug
      @ANKITCHAUHAN-do2ug Před rokem

      @@sujoyseal195 how can u say it will always form a tree ?

  • @aviral4080
    @aviral4080 Před 3 lety +3

    Bhaiya Apne DSA exactly konse course sei sikha tha...pls bata dijiye . Kya Aapne coding ninjas wagera Ka course kaara tha ?

  • @preritagrawal2094
    @preritagrawal2094 Před 3 lety +2

    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

    • @sahil.rajput2000
      @sahil.rajput2000 Před 3 lety +1

      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

    • @rounakbhatia5995
      @rounakbhatia5995 Před rokem

      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      add these lines in the main before taking inputs

  • @SaadKasu
    @SaadKasu Před 2 lety

    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 ?

    • @AbhishekMishra-me4mu
      @AbhishekMishra-me4mu Před 2 lety

      Yes! In a tree every pair of node should contain exactly one path between them.

  • @saurabhmishra8411
    @saurabhmishra8411 Před 3 lety +2

    abhi to iss aproach se tle aa raha last ke do test cases me

    • @harshit23
      @harshit23 Před 3 lety

      same bhai.. kch change kiya ab tumne uske liye?

    • @shubhamsood1406
      @shubhamsood1406 Před 3 lety +6

      // to avoid TLE write these lines in your main()
      ios::sync_with_stdio(0);
      cin.tie(0);

    • @chiragtejwani1803
      @chiragtejwani1803 Před 3 lety +1

      @@shubhamsood1406 thanks brother

    • @gamingbar3881
      @gamingbar3881 Před 2 lety

      @@shubhamsood1406 Still I am getting TLE after adding this..

    • @vikasupadhyay7916
      @vikasupadhyay7916 Před 2 lety

      thanks bhai, this actually worked :)

  • @tech_wizard9315
    @tech_wizard9315 Před 3 lety

    When will you announce gievway results of Amazon SDE

  • @ayushasthana4886
    @ayushasthana4886 Před 2 lety

    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🙏.

  • @dochimekashiariri7610
    @dochimekashiariri7610 Před 2 lety

    thanks a lot

  • @shreyashachoudhary480
    @shreyashachoudhary480 Před 3 lety

    Amazing!

  • @dakshdagariya2692
    @dakshdagariya2692 Před 3 lety

    good

  • @Impromptu21
    @Impromptu21 Před 3 lety

    Other way is reverse the graph ..

  • @swapnildhiman6585
    @swapnildhiman6585 Před 3 lety

    ❤️

  • @altafmazhar7762
    @altafmazhar7762 Před 2 lety

    Op bhai

  • @srijandasbiswas4864
    @srijandasbiswas4864 Před 3 lety

    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

  • @SubhamKumar-9009
    @SubhamKumar-9009 Před 3 lety

    👍🏼