2020年9月13日

41. First Missing Positive

摘要: Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3,4,-1,1] Output: 阅读全文

posted @ 2020-09-13 16:31 wsw_seu 阅读(70) 评论(0) 推荐(0) 编辑

268. Missing Number

摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output 阅读全文

posted @ 2020-09-13 14:47 wsw_seu 阅读(121) 评论(0) 推荐(0) 编辑

154. Find Minimum in Rotated Sorted Array II(循环数组查找)

摘要: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). F 阅读全文

posted @ 2020-09-13 14:01 wsw_seu 阅读(94) 评论(0) 推荐(0) 编辑

局部最小值(二分)

摘要: 局部最小存在的几种情况,1. 长度为1,arr[0]就是局部最小;2. 数组的开头,如果arr[0] < arr[1] ,arr[0]被定义为局部最小。 3. 数组的结尾,如果arr[N-1] < arr[N-2] ,arr[N-1]被定义为局部最小。 所以剩下就是数组下标1~N-2之间的了。再按a 阅读全文

posted @ 2020-09-13 12:13 wsw_seu 阅读(1108) 评论(0) 推荐(0) 编辑

92. Reverse Linked List II 翻转链表II

摘要: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Out 阅读全文

posted @ 2020-09-13 11:00 wsw_seu 阅读(80) 评论(0) 推荐(0) 编辑

leetcode Reverse Nodes in k-Group翻转链表K个一组

摘要: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文

posted @ 2020-09-13 10:44 wsw_seu 阅读(158) 评论(0) 推荐(0) 编辑

导航