0

# Odd Even Linked List

Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You shou

0

# Sort List

Sort ListSort a linked list in O(n log n) time using constant space complexity. 提示 解題應用 LinkedList Pointer Sort MergeSort Default:12345678910/** * Definition for singly-linked list. * typ

0

# Insertion Sort List

Insertion Sort ListSort a linked list using insertion sort. 提示 解題應用 LinkedList Pointer Sort Insertion Sort Default:12345678910/** * Definition for singly-linked list. * type ListNode stru

0

# Reorder List

Reorder ListGiven a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes’ values. For example:1Given {1,2,3,4},

0

# Convert Sorted List to Binary Search Tree

Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 提示 解題應用 DepthFirstSearch InorderTravel

0

# Reverse Linked List II

Reverse Linked List IIReverse a linked list from position m to n. Do it in-place and in one-pass. For example:123Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2-&

0

# Partition List

Partition ListGiven a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the node

0

# Remove Duplicates from Sorted List II

Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example:12Given 1->2->3-

0

# Rotate List

Rotate ListGiven a list, rotate the list to the right by k places, where k is non-negative. For example:12Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.

0

# Add Two Numbers

Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numb

0

# Palindrome Linked List

Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? 提示 解題應用 LinkedList Pointer Default:12345678910/**

0

# Reverse Linked List

Reverse Linked ListReverse a singly linked list. 提示 解題應用 LinkedList Pointer Default:12345678910/** * Definition for singly-linked list. * type ListNode struct { * Val int * Nex

0

# Remove Linked List Elements

Remove Linked List ElementsRemove all elements from a linked list of integers that have value val. Example:12Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2

0

# Remove Duplicates from Sorted List

Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear only once. For example:12Given 1->1->2, return 1->2.Given 1->1->2->

0

# Swap Nodes in Pairs

Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head. For example: 1Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm s

0

# Merge Two Sorted Lists

Merge Two Sorted ListsMerge 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. 提示 解題應用 LinkedList Pointer

0

# Remove Nth Node From End of List

Remove Nth Node From End of ListGiven a linked list, remove the nth node from the end of list and return its head. Example: 123Given linked list: 1->2->3->4->5, and n = 2.After removing t