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
three blue-and-yellow parrots on tree branch

Binary Algorithm Summaries

Continuing through the Blind 75 summarizations, here are the binary-related questions. There are not many tricks with these questions, this is just testing knowledge on binary operations. Sum of Two Integers Find sum of two integers without using built in integer operators. Solution with O(1)/O(1): Use binary operators: Take binary AND of the input integers, shift left 1, that is the carry Take binary XOR of the input integers, that is the result Recursively repeat with result and carry instead of the input integers, until the carry is 0 Number of 1 Bits Given an integer, return the number of 1 bits in its binary representation. ...

July 14, 2024 · 2 min
Corn Field

Array Algorithm Summaries

For software developers, there’s some pride in being able to solve complex algorithm questions. Day to day development might not require the same level of complexity, but pushing your understanding of data structures and algorithms can give you the right tools to solve other problems with a balance of simplicity and efficiency. That’s why I wanted to check my understanding by summarizing the Leetcode Blind 75 problems and at least one solution. ...

June 30, 2024 · 4 min