Array

Sum

Product

Majority

Max Consecutive

  • No. 485: Max Consecutive Ones

  • No. 487: Max Consecutive Ones II https://eugenejw.github.io/2017/08/leetcode-487 (also applicable to 1004)

  • No. 1004: Max Consecutive Ones III

    • O(1) space: moving window

    • time: queue

  • No. 1446: Consecutive Characters (485)

  • No. 1869: Longer Contiguous Segments of Ones than Zeros (485)

  • No. 1784: Check if Binary String Has at Most One Segment of Ones (485)

  • No. 1550: Three Consecutive Odds (485)

  • No. 128: Longest Consecutive Sequence: Hashing

  • No. 829: Consecutive Numbers Sum: calculation O(sqrt(N))

Amplitude

Kth

  • No. 215 Kth Largest Element in an Array: Sort; Heap; Quick Select

  • No. 230 Kth Smallest Element in a BST: tranverse; can add one element to the node

  • No. 378 Kth Smallest Element in a Sorted Matrix: binary search; median of median + saddleback search https://discuss.leetcode.com/topic/53126/o-n-from-paper-yes-o-rows

  • No. 668 Kth Smallest Number in Multiplication Table: this is a sorted matrix

  • No. 373 Find K Pairs with Smallest Sums: Heap: pointer

Stock:

Trapping Water/Rain

Other:

Last updated