Skip to content

Latest commit

 

History

History
117 lines (90 loc) · 3.18 KB

File metadata and controls

117 lines (90 loc) · 3.18 KB

Pattern: Sliding window

  • [Easy] Maximum sum subarray of size k
  • [Easy] Smallest subarray with a given sum
  • [Medium] Longest substring with k distinct characters
  • [Medium] Fruits into baskets
  • [Hard] Nor repeat substring
  • [Hard] Longest substring with same letters after replacement

Pattern: Two pointers

  • [Easy] Pair with target sum
  • [Easy] Remove duplicates
  • [Easy] Squaring a sorted array
  • [Medium] Triplet sum close to target
  • [Medium] Triplets with smaller sum
  • [Medium] Subarray with product less than a target
  • [Medium] Dutch national flag problem

Pattern: Fast and slow pointers

  • [Easy] Middle of the LinkedList
  • [Easy] LinkedList cycle
  • [Medium] Start of LinkedList cycle
  • [Medium] Happy number

Pattern: Merge intervals

  • [Medium] Merge intervals
  • [Medium] Insert interval
  • [Medium] Interval intersection
  • [Medium] Conflicting appointments

Pattern: Cyclic sort

  • [Easy] Cyclic sort
  • [Easy] Finding the missing number
  • [Easy] Find all duplicate numbers

Pattern: In-place reversal of a LinkedList

  • [Easy] Reverse a LinkedList
  • [Medium] Reverse a sub-list
  • [Medium] Reverse every k-elements sub-list

Pattern: Tree breadth first search

  • [Easy] Binary tree level order traversal
  • [Easy] Reverse level order traversal
  • [Medium] Zigzag traversal
  • [Easy] Level averages in a binary tree
  • [Easy] Minimum depth of a binary tree
  • [Easy] Level order successor
  • [Medium] Connect level order siblings

Pattern: Tree depth first search

  • [Easy] Binary tree path sum
  • Medium Validate Binary Search Tree
  • [Medium] All paths for a sum
  • [Medium] Sum of path numbers
  • [Medium] Path with given sequence
  • [Medium] Count paths for a sum

Pattern: Two heaps

  • [Medium] Find a median of a number stream
  • [Hard] Sliding window median
  • [Hard] Maximize capital

Pattern: Subsets

  • [Easy] Subsets
  • [Easy] Subsets with duplicates
  • [Medium] Permutations
  • [Medium] String permutations by changing case
  • [Hard] Balanced parenthesis
  • [Hard] Unique generalized abbreviations

Pattern: Modified Binary Search

  • [Easy] Order-agnostic binary search
  • [Medium] Ceiling of a number
  • [Medium] Next letter
  • [Medium] Number range
  • [Medium] Search in a sorted infinite array
  • [Medium] Minimum difference element
  • [Easy] Bitonic array maximum

Pattern: K elements

  • [Easy] Top 'K' numbers
  • [Easy] Kth smallest number
  • [Easy] 'K' closest points to the origin
  • [Easy] Connect ropes
  • [Medium] Top 'K' frequent numbers
  • [Medium] Frequency sort
  • [Medium] Kth Largest number in a stream
  • [Medium] 'K' Closest numbers
  • [Medium] Maximum distinct elements
  • [Medium] Sum of elements
  • [Hard] Rearrange string

Pattern: K-way merge

  • [Medium] Merge K sorted lists
  • [Medium] Kth smallest number in M sorted lists
  • [Hard] Kth smallest number in a sorted matrix
  • [Hard] Smallest number range

Topological sort

  • [Medium] Topological sort
  • [Medium] Tasks scheduling
  • [Medium] Tasks scheduling order
  • [Hard] All tasks scheduling orders
  • [Hard] Alien dictionary