Skip to content

Instantly share code, notes, and snippets.

@andrehadianto
Forked from aaronreulkhoo/grokking_to_leetcode.md
Created September 28, 2022 14:14
Show Gist options
  • Save andrehadianto/9eba0a46b1c37a9c39afbb38d6a03579 to your computer and use it in GitHub Desktop.
Save andrehadianto/9eba0a46b1c37a9c39afbb38d6a03579 to your computer and use it in GitHub Desktop.
Grokking the Coding Interview

GROKKING NOTES

Curated list of leetcode problems which are close to the grokking course.

Pattern: Sliding Window

def maximumSumSubarray (self,K,nums,N): if K>len(nums): raise Exception("dafak")
total=0
greatest=0
for i in range(K):
    total+=nums[i]

greatest=total
for i in range(K,len(nums)):
    total += nums[i] - nums[i-K]
    if total>greatest:
        greatest=total


return greatest

Pattern: Two Pointers

Pattern: Fast & Slow pointers

Pattern: Merge Intervals

Pattern: Cyclic Sort

Pattern: In-place Reversal of a LinkedList

Pattern: Tree Breadth First Search

Pattern: Tree Depth First Search

Pattern: Two Heaps

Pattern: Subsets

Pattern: Modified Binary Search

Pattern: Bitwise XOR

Pattern: Top 'K' elements

Pattern: K-way merge

Pattern: 0/1 Knapsack

Pattern: Topological Sort

Misc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment