How to Reverse a LinkedList In-place by Alternating K Sublists

Опубликовано: 13 Октябрь 2024
на канале: Coderbyte
752
16

Part 2 of a 3 Part Series on Reversing LinkedLists

Watch part 1 here:    • Step by Step Walkthrough of Reversing...  

In this video, we continue exploring how to reverse a LinkedList by exploring a medium difficulty interview problem.

The Challenge (Medium):
Given the head of a LinkedList and a number 'k', reverse every alternating 'k' sized sub-list starting from the head.

If, in the end, you are left with a sub-list with less than 'k' elements, reverse it too.

Video Overview:
0:33 Overview
1:20 Problem
3:03 Approach
8:01 Coding a Javascript Solution
29:06 Recap

Please subscribe to our channel :)

Join us next week for part 3 of this pattern where we’ll walk through a more challenging problem using LinkedLists.

Additional Resources:
Practice hundreds of real coding challenges at https://coderbyte.com/
Check out our tiktoks @coderbyte