摘要: 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 阅读(432) 评论(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 阅读(453) 评论(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 阅读(441) 评论(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 阅读(426) 评论(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 阅读(430) 评论(0) 推荐(0)
摘要: Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] 阅读全文
posted @ 2019-11-05 15:46 CNoodle 阅读(184) 评论(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 阅读(452) 评论(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 阅读(159) 评论(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 阅读(209) 评论(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 阅读(484) 评论(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 阅读(438) 评论(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 阅读(471) 评论(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 阅读(380) 评论(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 阅读(467) 评论(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 阅读(337) 评论(0) 推荐(0)
摘要: Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found 阅读全文
posted @ 2019-11-04 12:18 CNoodle 阅读(536) 评论(0) 推荐(0)
摘要: You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, hei 阅读全文
posted @ 2019-11-02 12:41 CNoodle 阅读(492) 评论(0) 推荐(0)
摘要: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c 阅读全文
posted @ 2019-11-01 14:07 CNoodle 阅读(164) 评论(0) 推荐(0)
摘要: Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is 阅读全文
posted @ 2019-11-01 13:50 CNoodle 阅读(611) 评论(0) 推荐(0)
摘要: Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest 阅读全文
posted @ 2019-11-01 12:16 CNoodle 阅读(278) 评论(0) 推荐(0)