![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
TwoPointers
weixin_39145266
这个作者很懒,什么都没留下…
展开
-
42 Trapping Rain Water
1 题目Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented b...原创 2019-11-24 13:30:30 · 55 阅读 · 0 评论 -
881 Boats to Save People
1 题目Thei-th person has weightpeople[i], and each boat can carry a maximum weight oflimit.Each boat carries at most 2 people at the same time, provided the sum of theweight of those people is a...原创 2019-08-11 18:23:59 · 63 阅读 · 0 评论 -
763 Partition Labels
1 题目A stringSof lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers represent...原创 2019-08-19 11:49:31 · 103 阅读 · 0 评论 -
234 Palindrome Linked List
1 题目Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:Could you do it in O(n) ...原创 2019-05-07 14:57:01 · 72 阅读 · 0 评论 -
283 Move Zeroes
1 题目Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.Example:Input: [0,1,0,3,12]Output: [1,3,12,0,0]Note:...原创 2019-05-06 15:20:24 · 59 阅读 · 0 评论 -
125 Valid Palindrome
1 题目Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note:For the purpose of this problem, we define empty string as valid palindrome....原创 2019-05-06 15:02:05 · 60 阅读 · 0 评论 -
88 Merge Sorted Array
1 题目Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:The number of elements initialized innums1andnums2aremandnrespectively. You may assume...原创 2019-04-26 18:15:11 · 197 阅读 · 0 评论 -
86 Partition List
1 题目Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the original relative order of the nodes in eac...原创 2019-03-29 09:16:55 · 53 阅读 · 0 评论 -
80 Remove Duplicates from Sorted Array II
1 题目Given a sorted arraynums, remove the duplicatesin-placesuch that duplicates appeared at mosttwiceand return the new length.Do not allocate extra space for another array, you must do this ...原创 2019-03-29 09:17:26 · 63 阅读 · 0 评论 -
75 Sort Colors
1 题目Given an array withnobjects colored red, white or blue, sort themin-placeso that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use ...原创 2019-03-29 09:17:19 · 79 阅读 · 0 评论 -
287 Find the Duplicate Number
1 题目Given an arraynumscontainingn+ 1 integers where each integer is between 1 andn(inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate numbe...原创 2019-03-30 12:25:01 · 77 阅读 · 0 评论 -
209 Minimum Size Subarray Sum
1 题目Given an array ofnpositive integers and a positive integers, find the minimal length of acontiguoussubarray of which the sum ≥s. If there isn't one, return 0 instead.Example:Input: s...原创 2019-03-30 11:52:54 · 44 阅读 · 0 评论 -
61 Rotate List
1 题目Given a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.2 尝试解class Solution {public: ListNode* rotateRight(ListNode* head, int k) { if(head == NU...原创 2019-03-29 09:16:15 · 40 阅读 · 0 评论 -
142 Linked List Cycle II
1 题目Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.To represent a cycle in the given linked list, we use an integerposwhich represents the positio...原创 2019-03-29 15:21:34 · 54 阅读 · 0 评论