Tags » Linked List

Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.

For example,
Given 1->2->3->4, you should return the list as 2->1->4->3… 69 more words

Linked List

Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 61 more words

Linked List

Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.

For example,

   Given linked list: 1->2->3->4->5, and n = 2. 94 more words
Linked List

Add two numbers represented by linked lists in C#

Given two numbers represented by two lists, write a function that returns sum list. The sum list is list representation of addition of two input numbers. 145 more words


Remove Linked List Elements

Remove all elements from a linked list of integers that have value val.

Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6… 57 more words

Linked List

Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

Do not allocate extra space for another array, you must do this in place with constant memory. 62 more words

Linked List

Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.

For example,
Given 1->2->3->3->4->4->5, return… 78 more words

Linked List