- O(n) time complexity and O(n) space complexity using helper object / Codepen
- O(n) time complexity and O(1) space complexity using bitwise operators / Codepen
- O(n log n) time complexity and O(1) space complexity using sorting / Codepen
- O(n) time complexity and O(1) space complexity using sorting / Codepen
- O(n) time complexity and O(n) space complexity using helper object / Codepen
- O(mn) time complexity where n = length of the text and m = length of the pattern / Codepen
- KMP algorithm: O(m + n) time complexity where n = length of the text and m = length of the pattern / Codepen
- O(n) time complexity where n = length of the text / Codepen
- O(n) time complexity where n = length of the text / Codepen
- Solution using suffix arrays, O(n) time complexity / Codepen
- Solution using 2d array, O(mn) / Codepen
- O(n^2) time complexity and O(1) space complexity using matrix transpose / Codepen
- O(n^2) time complexity and O(1) space complexity / Codepen
- O(n^2) time complexity and O(n^2) space complexity using additional arrays / Codepen
Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
- Singly-linked list implementation - add, remove, get, toString / Codepen
- Doubly-linked list implementation - add, remove, get, toString / Codepen
- Sort singly-linked list using merge sort - O(n log n) time complexity and O(n) space complexity / Codepen
-
Remove duplicates from unsorted singly-linked list using merge sort - O(n log n) time complexity and O(n) space complexity, the array order is not saved / Codepen
-
Remove duplicates from unsorted singly-linked list using beffer - O(n) time complexity and O(n) space complexity, the array order is saved / Codepen
You have two numbers represented by a linked list, where each node contains a sin- gle digit. The digits are stored in reverse order, such that the 1’s digit is at the head of the list. Write a function that adds the two numbers and returns the sum as a linked list.
EXAMPLE:
Input: (3 -> 1 -> 5), (5 -> 9 -> 2)
Output: 8 -> 0 -> 8
- Stack implementation using array / Codepen
- Stack implementation using singly-linked-list - push, pick and isEmpty O(1), pop O(n) / Codepen
- Stack implementation using doubly-linked-list - push, pop, pick, isEmpty O(1) / Codepen
- Binary tree insert using queue; inorder, preorder and postorder traversals; find a node; remove a node; find deepest node; / Codepen
- Binary search tree insert; inorder, preorder and postorder traversals; find a node; remove a node; find min node; / Codepen