描述
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep c
...
描述
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k the
...
描述
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->
...
描述
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
...
描述
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
...
描述
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:Given 1->2->3->4->5->NULL and k = 2,ret
...
描述
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,Given 1->1->2, return 1->2.Given 1-
...
描述
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,Given 1
...
描述
Given 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 t
...
描述
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,
...
描述
Reverse a singly linked list.
分析简单题,翻转单链表。时间O(n),空间O(1)。
代码Python1234567891011121314151617181920# Definition for singly-linked list.class ListNode
...
描述
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing
...
描述
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elemen
...
描述
Given an array of integers, every element appears three times except for one. Find that single one.
Note:Your algorithm should have a linear runtim
...
描述
Given an array of integers, every element appears twice except for one. Find that single one.
Note:Your algorithm should have a linear runtime comp
...