#双指针
fantow
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode题解 -- 双指针(524)
Longest Word in Dictionary through DeletingGiven a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If the...原创 2020-03-07 11:17:25 · 189 阅读 · 0 评论 -
LeetCode题解 -- 双指针(141)
Linked List CycleGiven a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked l...原创 2020-03-06 22:42:48 · 182 阅读 · 0 评论 -
LeetCode题解 -- 双指针(680)
Valid Palindrome IIGiven a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.时间复杂度:O(n^2)空间复杂度:O(1)没找到其他的方法,基本上都是这样做的public boolean validPalindr...原创 2020-03-06 22:09:16 · 268 阅读 · 0 评论 -
LeetCode题解 -- 双指针(345)
Reverse Vowels of a StringWrite a function that takes a string as input and reverse only the vowels of a string.时间复杂度:O(n)空间复杂度:O(n)代码逻辑类似于快排public String reverseVowels(String s) { int le...原创 2020-03-06 20:24:54 · 185 阅读 · 0 评论 -
LeetCode题解 -- 双指针(633)
Sum of Square NumbersGiven a non-negative integer c, your task is to decide whether there’re two integers a and b such that a2 + b2 = c.相似题目:LeetCode题解 – 双指针(167)时间复杂度:O(n)空间复杂度:O(1)public boolea...原创 2020-03-06 20:07:16 · 142 阅读 · 0 评论 -
双指针问题汇总
优快云某篇博客汇总Cyc2018原创 2020-03-06 18:26:42 · 176 阅读 · 0 评论 -
LeetCode题解 -- 双指针(88)
88. Merge Sorted ArrayGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.The number of elements initialized in nums1 and nums2 are m and n respectively.You ...原创 2020-03-06 18:22:59 · 130 阅读 · 0 评论 -
LeetCode题解 -- 双指针(287)
Find the Duplicate NumberGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is onl...原创 2020-03-06 17:41:24 · 177 阅读 · 0 评论 -
LeetCode题解 -- 双指针(80)
Remove Duplicates from Sorted Array IIGiven a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.Do not allocate extra space for ...原创 2020-03-06 16:33:59 · 501 阅读 · 0 评论 -
LeetCode题解 -- 双指针(26)
Remove Duplicates from Sorted ArrayGiven a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another...原创 2020-03-06 14:09:27 · 150 阅读 · 0 评论 -
LeetCode题解 -- 双指针(27)
Remove ElementGiven an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying ...原创 2020-03-06 11:53:55 · 232 阅读 · 0 评论 -
LeetCode题解 -- 双指针(42)
Trapping Rain WaterGiven n non-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.经典的接雨水问题方法一:第 i 块区域积水面积 = M...原创 2020-03-05 19:29:01 · 127 阅读 · 0 评论 -
LeetCode题解 -- 双指针(11)
11. Container With Most WaterGiven n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at ...原创 2020-03-05 16:09:01 · 145 阅读 · 0 评论 -
LeetCode题解 -- 双指针(18)
4SumGiven an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum o...原创 2020-03-05 15:43:33 · 110 阅读 · 0 评论 -
LeetCode题解 -- 双指针(16)
3Sum ClosestGiven an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each...原创 2020-03-05 14:36:01 · 157 阅读 · 0 评论 -
LeetCode题解 -- 双指针(15)
15. 3SumGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.时间复杂度:O(n^2)空间复杂度:O(1)先固定第一...原创 2020-03-05 13:08:39 · 137 阅读 · 0 评论 -
LeetCode题解 -- 双指针(167)
167. Two Sum II - Input array is sortedGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum sh...原创 2020-03-05 12:27:33 · 155 阅读 · 0 评论 -
LeetCode题解 -- 双指针(325)
Maximum Size Subarray Sum Equals k 最大子数组之和为kGiven an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn’t one, return 0 instead.Given nums = [1, -1, ...原创 2020-03-05 10:40:18 · 356 阅读 · 0 评论
分享