📝
notes
  • Initial page
  • 02_ds_algo
    • ds
      • Union Find
      • Binary Indexed Tree
      • Stack
      • String
      • Linked List
      • Segment Tree
      • Union Find
      • Union Find
      • Array
      • Tree
      • Hash Table
      • queue
    • algo
      • Backtracking
      • Sort
      • Binary Search
      • Depth First Search
      • Bit Manipulation
      • Dynamic Programming
      • Breadth First Search
      • Two Pointers
      • Math
      • Sliding Window
    • leetcode
      • List
      • 1. Two Sum
      • READEME
      • 2. Add Two Numbers
  • README
    • README
      • pointer
      • effective-cpp
      • roadmap
      • pimpl
      • smartptr
  • 03_cheatsheet
    • README
      • git
      • gdb
    • README
      • bash
      • Python 速查表中文版
    • README
      • vim
Powered by GitBook
On this page

Was this helpful?

  1. 02_ds_algo
  2. algo

Sliding Window

  • 双指针滑动窗口的经典写法。右指针不断往右移,移动到不能往右移动为止(具体条件根据题目而定)。当右指针到最右边以后,开始挪动左指针,释放窗口左边界。第 3 题,第 76 题,第 209 题,第 424 题,第 438 题,第 567 题,第 713 题,第 763 题,第 845 题,第 881 题,第 904 题,第 978 题,第 992 题,第 1004 题,第 1040 题,第 1052 题。

  • 滑动窗口经典题。第 239 题,第 480 题。

No.

Title

Solution

Difficulty

TimeComplexity

SpaceComplexity

Favorite

Acceptance

0003

Longest Substring Without Repeating Characters

Medium

O(n)

O(1)

❤️

31.3%

0076

Minimum Window Substring

Hard

O(n)

O(n)

❤️

35.8%

0239

Sliding Window Maximum

Hard

O(n * k)

O(n)

❤️

44.5%

0424

Longest Repeating Character Replacement

Medium

O(n)

O(1)

48.0%

0480

Sliding Window Median

Hard

O(n * log k)

O(k)

❤️

38.5%

0567

Permutation in String

Medium

O(n)

O(1)

❤️

44.6%

0978

Longest Turbulent Subarray

Medium

O(n)

O(1)

❤️

46.6%

0992

Subarrays with K Different Integers

Hard

O(n)

O(n)

❤️

50.5%

0995

Minimum Number of K Consecutive Bit Flips

Hard

O(n)

O(1)

❤️

49.6%

1004

Max Consecutive Ones III

Medium

O(n)

O(1)

60.6%

1040

Moving Stones Until Consecutive II

Medium

O(n log n)

O(1)

❤️

53.9%

1052

Grumpy Bookstore Owner

Medium

O(n log n)

O(1)

55.7%

1074

Number of Submatrices That Sum to Target

Hard

O(n^3)

O(n)

❤️

61.5%

1208

Get Equal Substrings Within Budget

Medium

43.7%

1658

Minimum Operations to Reduce X to Zero

Medium

33.4%

------------

-------------------------------------------------------

-------

----------------

---------------

-------------

-------------

-------------

PreviousMathNextleetcode

Last updated 4 years ago

Was this helpful?