Move the last node to the front of a linked list
Given a linked list, move its last node to the front. For example, list {1, 2, 3, 4} should be changed to {4, 1, 2, 3}.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a linked list, move its last node to the front. For example, list {1, 2, 3, 4} should be changed to {4, 1, 2, 3}.
Given a linked list, check if it is a palindrome or not.
Given a linked list, rearrange linked list nodes in a specific way in linear time and constant space. The alternate positions in the output list should be filled with nodes starting from the beginning and end of the original list.
Given a linked list and two positive integers, m and n, delete every n nodes after skipping m nodes.
Given two linked lists, merge their nodes into the first list by taking nodes alternately between the two lists. If the first list runs out, the remaining nodes of the second list should not be moved.
Given a linked list and a positive integer k, find the k’th node from the end of the list.
Given a linked list, reverse every adjacent group of k nodes where k is a given positive integer.
This post will reverse the linked list using recursion in C, C++, Java, and Python.
Given a linked list, sort it using the merge sort algorithm. Merge sort is an efficient, general-purpose sorting algorithm that produces a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output.
Write a function that takes two lists, each of which is sorted in increasing order, and merges the two into a single list in increasing order, and returns it.
Given two linked lists, merge their nodes to make one list, taking nodes alternately between the two lists. If either list runs out, all the nodes should be taken from the other list.
Given a linked list, split it into two lists containing alternating elements from the original list. The elements in the new lists may be in any order.