01_Sequences
Arrays and Strings.
https://www.techinterviewhandbook.org/algorithms/array/
Techniques
https://www.techinterviewhandbook.org/coding-interview-techniques/
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
def find_all_subarrays(nums, target): """ Finds and prints all contiguous subarrays w...
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
Need to know: Dictionary, for loop def count_characters(string): counts = {} for ch...
Anagram
An anagram is word switch or word play. It is the result of rearranging the letters of a word or ...
Palindrome
Palindrome Worse approaches Reversing the String:You can reverse the string (using slicing ...