Posts with tag 'linked list'

Linked List Partitioning

less than 1 minute read

You are given a singly linked list node and an integer k. Order the linked list so that all nodes whose values are less than k come first, all nodes whose va...

Reverse an Inner Linked List

less than 1 minute read

Given a singly linked list node, and integers i and j, reverse the linked list from i to jth nodes, 0 indexed and inclusive.

Reverse Linked List Groups

less than 1 minute read

Given a singly linked list node, and an integer k, reverse every k contiguous group of nodes.

Sort a Linked List

less than 1 minute read

Given a singly linked list of integers node, sort the nodes by their values in ascending order.

Linked List Intersection

less than 1 minute read

Given two sorted linked lists l0, and l1, return a new sorted linked list containing the intersection of the two lists.

Linked List Folding

1 minute read

You are given a singly linked list node containing integer values. Take the first half of the linked list and fold over the second half and merge the interse...

Swap Kth Node Values

less than 1 minute read

You are given a singly linked list node and an integer k. Swap the value of the k-th (0-indexed) node from the end with the k-th node from the beginning.

Interleaved Linked List

less than 1 minute read

Given two linked lists l0 and l1, return the two linked lists interleaved, starting with l0. If there are leftover nodes in a linked list, they should be add...

Pairwise Linked List Swap

less than 1 minute read

Given a singly linked list node, swap each pair of nodes and return the new head.

Kth Last Node of a Linked List

less than 1 minute read

Given a singly linked list node, return the value of the kth last node (0-indexed). k is guaranteed not to be larger than the size of the linked list.

Central Linked List

less than 1 minute read

Given a singly linked list node, return the value of the middle node. If there’s two middle nodes, then return the second one.

Rotate Linked List by K

less than 1 minute read

Given a linked list node and a non-negative integer k, rotate the list to the right by k places.

Reverse a Linked List

less than 1 minute read

Given a singly linked list node, return its reverse.

Remove Duplicates in Linked List

less than 1 minute read

Given a singly linked list node, remove nodes with duplicate values while maintaining relative order of the original list.

Palindrome Linked List

less than 1 minute read

Given a singly linked list node whose values are integers, determine whether the linked list forms a palindrome.

Linked List Union

less than 1 minute read

Given two sorted linked lists node0, and node, return a new sorted linked list containing the union of the two lists.

Linked List to Integer

less than 1 minute read

Given a single linked list node, representing a binary number with most significant digits first, return it as an integer.

Linked List Jumps

less than 1 minute read

You are given a singly linked list node containing positive integers. Return the same linked list where every node’s next points to the node val nodes ahead....

Linked List Deletion

less than 1 minute read

Given a singly linked list node, and an integer target, return the same linked list with all nodes whose value is target removed.

Length of a Linked List

less than 1 minute read

Given a singly linked list node, return its length. The linked list has fields next and val.

Binary Tree to Linked List

less than 1 minute read

Given a binary tree root, convert it to a singly linked list using an inorder traversal.

Back to Front Linked List

less than 1 minute read

Given a singly linked list node, reorder it such that we take: the last node, and then the first node, and then the second last node, and then the second nod...

Add Linked Lists

less than 1 minute read

Given a singly linked list l0 and another linked list l1, each representing a number with least significant digits first, return the summed linked list.

A Strictly Increasing Linked List

less than 1 minute read

Given the head of a singly linked list head, return whether the values of the nodes are sorted in a strictly increasing order.

Back to top ↑