随笔分类 - SlidingWindow&Pointer
滑动窗口和双指针
[Leetcode 11]容器中装最多的水Container With Most Water
摘要:【题目】 木桶短板,能装的最多水,由最短的那条决定 Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are dr
阅读全文
[Leetcode 26/27/80/283/977]移除(重复)元素 指针专题整理
摘要:【总结】 参考https://www.bilibili.com/video/BV1Pv4y1Z76N 适用情况:大部分需数组升序 【代码】 27 移除元素 不用管移除后半部分是否为正确答案,所以可直接nums[flag]=nums[i] class Solution { public int rem
阅读全文
[Leetcode 44]合并有序列表Merge k Sorted Lists
摘要:【题目】 找到第一个没有重复出现的字母 Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: I
阅读全文
[Leetcode 15]三数之和 3 Sum
摘要:【题目】 Given 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
阅读全文
[Leetcode 3] 最长不重复子串 Longest substring without repeating 滑动窗口
摘要:【题目】 Given a string, find the length of the longest substring without repeating characters. 【举例】 Example 1: Input: "abcabcbb" Output: 3 Explanation: T
阅读全文
浙公网安备 33010602011771号