Two Number Sum
Run Time
O(n^2) time and O(1) space
Pattern
Validate Subsequence
Run Time
O(n) time and O(1) space
Pattern
Sorted Squared Array
Run Time
O(n) time and O(1) space
Pattern
Tournament Winner
Run Time
O(n) time and O(k) space
Pattern
Find Closest Value in BST
Run Time
O(n) time and O(n) space
Pattern
Branch Sums
Run Time
O(n) time and O(k) space
Pattern
Node Depths
Run Time
O(n) time and O(k) space
Pattern
Depth First Search
Run Time
O(n) time and O(k) space
Pattern
Minimum Waiting Time
Run Time
O(nlogn) time and O(1) space
Pattern
Remove Duplicates From Linked List
Run Time
O(n) time and O(1) space
Pattern
Nth Fibonacci
(Dynamic Programming)
Run Time
O(n) time and O(1) space
Pattern
Product Sum
Run Time
O(n) time and O(d) space
Pattern
Binary Search
Run Time
O(log(n)) time and O(1) space
Pattern
Find Three Largest Number
Run Time
O(n) time and O(1) space
Pattern
Palindrome Check
Run Time
O(n) time, O(1) space
Pattern
Caesar Cipher Encryptor
(Shifting existing char in alphabet)
Run Time
O(n) time, O(n) space
Pattern
Run-Length Encoding
(AAAAAAAAAAAAaB → 9A1A1B)
Run Time
O(n) time, O(n) space
Pattern
aGenerate Document
(If random string makes document, return True)
Run Time
O(n+m) time, O(c) space
Pattern
First Non-Repeating Character
Run Time
O(n) time, O(1) space
Pattern
Non-Constructible Change
Run Time
O(nlogn) time, O(1) space
Pattern