Rotate List (LeetCode) | Linked List Interview Question Explanation

Sdílet
Vložit
  • čas přidán 5. 07. 2024
  • Link to the Code: gist.github.com/JyotinderSing...
    Link to the Problem: leetcode.com/problems/rotate-...
    Link to my GitHub: github.com/JyotinderSingh
    Link to my Website: jyotindersingh.com/
    Timestamps:
    00:00 - Problem Explanation
    01:02 - Algorithm
    04:01 - Coding Walkthrough
    _______________________________________
    Some great channels to learn more:
    Tushar Roy: / tusharroy2525
    Errichto: / @errichto
    Nick White: / @nickwhite
    Kevin Naughton Jr: / @kevinnaughtonjr
  • Věda a technologie

Komentáře • 14

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

    Bro please help me
    As you r replying I would like to ask u few questions.
    From how long r u solving problems on leetcode
    From how long time u r doing coding
    For beginners like us Is it correct way to see solutions like this on CZcams or discussion forum etc;
    How to think like u r thinking right now in this video

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

      Hey, I'd be happy to answer them.
      1. At the time this video was made it had been almost 6-7 months since I had started solving LeetCode questions.
      2. I'm in my final semester of college so I've been coding regularly for about 4 years now, though I did take CS in my school as well - so I had a bit of very basic C++ experience before I came to college.
      3 & 4. I'd say from personal experience, when you're just starting out - you probably do need to see videos and forum discussions to 'get' how these questions are approached. Otherwise you'd be wasting too much time on concepts you might not even understand, and it's not wise to spend more than 15 mins on a question when you have no idea how to even begin (only when you're starting out). After a point when you've solved some 20-30 easy questions, you should probably start attempting these questions more seriously, and maybe spend 20-30 mins trying things out before looking for hints. And even then, don't just look at the solution codes right away, read the explanations and try coding it out on your own - after which (no matter if you were successful or not) you should see how the top voted people solved the question or how people on CZcams approach it, just to gain more insight and get newer ideas. Personally I try to solve a question 3-4 more times after I've solved it for the first time without looking at the previous solution. And get back to that question after a couple of days (because most likely I'll get some new insight into it). And in the end its just a matter of practice :)

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

      @@JyotinderSingh thnx bro for ur time .
      Also,
      I am in my 2nd year I have chosen cs
      What tip u can give what should I do daily and what path I must follow
      What to do and not

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

      Thankyou so much for reply

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

      Hey, if I'm being honest - I really started preparing for coding interviews in 6th semester. Till that most of my time was spent exploring different technologies, trying to find what I enjoy doing - during that time I explored web dev, app dev, machine learning and whatever caught my attention. Which I feel is important to discover what you love. Something you don't wanna do is take too much advice - there's a ton of people (like me) ready to advise you on numerous things, but in the end its you who has to decide what you wanna do, don't feel intimidated if you see some certain xyz person doing something you don't understand - you're on your own journey and just focus on that. There are no wrong steps in this learning process (nothing that you learn will ever go to waste). What worked for me might not work for you - and that's something you'll need to see for yourself. Best of luck!

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

    Best

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

    Great explaination. Could you tell it's time complexity?

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

    nice one bro

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

    Nice video bro, also sound, If you don't mind can you please tell me what software you use to record your videos and what are its sound settings thank you

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

      Thanks a lot mate! I use Blue Snowball Microphone for the recording the sound, and I use Camtasia Studio to record the screen. Finally I edit the entire thing in Premiere Pro.

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

    thanks for clear explanation! This appeared in today's daily challenge. There's one part I'm still a little confused about, could you elaborate a little more on steps_to_new_tail is n - k? do we presume the list has rotated k steps, thus rest of n - k steps to go through the list in order to obtain the new tail position? Thanks in advanced!

    • @JyotinderSingh
      @JyotinderSingh  Před 3 lety

      We know the list has rotated by K steps, hence its mostly by analysing the list and the difference between its current and final state that we come to the conclusion that the new tail is (n - K) steps from the current tail.
      Hope that clears it up!