01_Sequences
Arrays and Strings.
Array Cheatsheet
Arrays Arrays hold values of the same type at contiguous memory locations. In an array, we're us...
01_Arrays
Brute Force
The brute force approach tries every possible combination to check for a solution, without levera...
Two Pointers: Inward Traversal
A pointer is a variable that represents and index or position within a data structure, such as an...
Two Pointers: Unidirectional Traversal
def shift_zeros_to_the_end(nums: List[int])-> None: # The 'left' pointer is used to position ...
Two Pointers: Stage Traversal
Problem: Partition Array by Parity Description: Given an integer array nums, rearrange the ar...
Sliding Window: Fixed
A subset of the Two Pointer Method, but uses left and right pointers to define the bounds of a "w...
Sliding Window: Dynamic
Traversing Array From The Right
Find Last Occurrence of Target in Array Description:Given an integer array nums and an integer...
Sorting The Array
When you receive an unsorted array and decide to sort it before applying the two-pointer techniqu...
Index as a Hash Key
String Cheatsheet
A string is a sequence of characters. Many tips that apply to Arrays also apply to Strings. Time...
02_Strings
Counting Characters in a String
String of unique characters A neat trick to count the characters in a string of unique characte...
String of Unique Characters
Counting characters Often you will need to count the frequency of characters in a string. The m...
Anagram
An anagram is word switch or word play. It is the result of rearranging the letters of a word or ...
Palindrome
Palindrome A palindrome is a word, phrase, number, or other sequence of characters which reads ...