open book lot

String Algorithm Summaries

Here are the summaries for the String algorithms in Leetcode’s Blind 75. A String is a sequence of characters used to represent text, usually to make something human-readable. It’s not really a data structure, but can be seen as similar to an array, so the solutions will be similar to those problems. Longest Substring Without Repeating Characters Given a string, find the longest subsequence of characters that doesn’t repeat characters. ...

September 1, 2024 · 8 min
four white, red, and blue vending machines

Matrix Algorithm Summaries

Here are the summaries for the Matrix algorithms in Leetcode’s Blind 75. A matrix is a 2 dimensional data structure consisting of rows and columns. For these problems, the matrix is represented with an array of arrays. Set Matrix Zeroes Given a matrix of integers, size m x n, if an input value is 0, set all values from its row and column to 0 as well. Solution with O(m*n) time / O(1) space ...

August 25, 2024 · 5 min
tilt shift photography of gray steel chains

Linked List Algorithm Summaries

Here are the Blind 75 Linked List Algorithm Summaries. A linked list is type of graph data structure with an additional constraint: the nodes form a chain by only having a maximum of one edge incoming and one outgoing. Since we can’t move backwards in this data structure or randomly access any node, we’ll use techniques like multiple pointers to solve these, ideally with one pass. Reverse a Linked List 1 2 3 { "prop": "value" } Given the head of a linked list, return it reversed. ...

August 18, 2024 · 4 min
Close-up of growth rings in a thick tree stump

Interval Algorithm Summaries

Here are the Blind 75 Interval Algorithm Summaries. An “Interval” data structure for the purpose of these Leetcode problems just means an array of Pairs, where each one represents a range of numbers. Insert Interval Given an array of non-overlapping sorted interval ranges, add the new input interval range so that the result is still sorted and non-overlapping. Solution with O(N) time / O(N) space Create a new array to hold the result. Iterate through the array of interval ranges: ...

August 10, 2024 · 3 min
photo of outer space

Graph Algorithm Summaries

Here are the Blind 75 Graph Algorithm Summaries. Graph data structures are used to represent relationships between data. The graph is composed of Nodes and Edges, where the Node holds some piece of data, and Edges connect Nodes together either with a directed or undirected relationship. Clone Graph Given a node from a connected graph, return a copy of the graph. Solution with O(N) Time / O(N) Space Recursively follow the starting node’s neighbors, making a copy of each node, and also saving the nodes to a hash map. When you encounter a node already in the hashmap, return the saved result. ...

July 26, 2024 · 4 min