This repository contains notes and examples for the LeetCode Data Structures and Algorithms Crash Course.
- Two pointers Approach:
- Solve an array problem in O(n) time complexity.
- Sliding Window Approach:
- Solve finding a valid (longest/smallest) subarray/substring in O(n) time complexity.
- Also, find number of valid sub-arrays.
- Prefix Sum:
- Only used for array of numbers(int/float).
- Used when the problem involves sum of sub-arrays.
Important Tip:
- Checking for the existence:
- Anytime you find your algorithm running
if ... in ...
, use hash map or set
- Anytime you find your algorithm running
- Counting/Frequency:
- Anytime you want to count something think of a hash map or a set.