摘要: Given the head of a singly linked list, return true if it is a palindrome. Example 1: Input: head = [1,2,2,1] Output: true Example 2: Input: head = [1 阅读全文
posted @ 2019-11-10 09:28 CNoodle 阅读(188) 评论(0) 推荐(0) 编辑
摘要: You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing toge 阅读全文
posted @ 2019-11-10 08:01 CNoodle 阅读(620) 评论(0) 推荐(0) 编辑
摘要: Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersec 阅读全文
posted @ 2019-11-10 07:54 CNoodle 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given the head of a linked list, return the list after sorting it in ascending order. Follow up: Can you sort the linked list in O(n logn) time and O( 阅读全文
posted @ 2019-11-10 05:54 CNoodle 阅读(551) 评论(0) 推荐(0) 编辑
摘要: Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there 阅读全文
posted @ 2019-11-10 05:24 CNoodle 阅读(457) 评论(0) 推荐(0) 编辑
摘要: Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the 阅读全文
posted @ 2019-11-10 04:16 CNoodle 阅读(420) 评论(0) 推荐(0) 编辑
摘要: Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the 阅读全文
posted @ 2019-11-08 03:24 CNoodle 阅读(437) 评论(0) 推荐(0) 编辑
摘要: Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well. Example 阅读全文
posted @ 2019-11-08 01:40 CNoodle 阅读(424) 评论(0) 推荐(0) 编辑
摘要: Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: Input: head = [1,2,3,4,5], n = 2 Output: 阅读全文
posted @ 2019-11-08 01:20 CNoodle 阅读(413) 评论(0) 推荐(0) 编辑
摘要: Given the head of 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 p 阅读全文
posted @ 2019-11-06 00:56 CNoodle 阅读(423) 评论(0) 推荐(0) 编辑
摘要: Given an array, rotate the array to the right by k steps, where k is non-negative. Follow up: Try to come up as many solutions as you can, there are a 阅读全文
posted @ 2019-11-05 15:46 CNoodle 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Given the head of a linked list, rotate the list to the right by k places. Example 1: Input: head = [1,2,3,4,5], k = 2 Output: [4,5,1,2,3] Example 2: 阅读全文
posted @ 2019-11-05 15:25 CNoodle 阅读(426) 评论(0) 推荐(0) 编辑
摘要: Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordere 阅读全文
posted @ 2019-11-05 03:34 CNoodle 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a target value in an m x n integer matrix. The matrix has the following properties: Integers in each ro 阅读全文
posted @ 2019-11-05 02:23 CNoodle 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
posted @ 2019-11-05 02:08 CNoodle 阅读(454) 评论(0) 推荐(0) 编辑
摘要: There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). Before being passed to your function, nums is ro 阅读全文
posted @ 2019-11-05 00:03 CNoodle 阅读(423) 评论(0) 推荐(0) 编辑
摘要: There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is rotated at an unknown 阅读全文
posted @ 2019-11-04 14:26 CNoodle 阅读(445) 评论(0) 推荐(0) 编辑
摘要: Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become: [ 阅读全文
posted @ 2019-11-04 13:39 CNoodle 阅读(357) 评论(0) 推荐(0) 编辑
摘要: Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [ 阅读全文
posted @ 2019-11-04 13:31 CNoodle 阅读(435) 评论(0) 推荐(0) 编辑
摘要: A peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its in 阅读全文
posted @ 2019-11-04 12:41 CNoodle 阅读(310) 评论(0) 推荐(0) 编辑