Cracking the Coding Interview questions on Leetcode

Monday, March 30, 2020

Note this page is still work in progress

Chapter 1: Arrays and Strings

1.1 Is Unique
217. Contains Duplicate

1.2 Check Permutation
567. Permutation in String

1.3 URLify
404

1.4 Palindrome Permutation
266. Palindrome Permutation (Leetcode premium)

1.5 One Away
72. Edit Distance (more difficult)

1.6 String Compression
443. String Compression

1.7 Rotate Matrix
48. Image

1.8 Zero Matrix
73. Set Matrix Zeroes

1.9 String Rotation
796. Rotate String (similar idea)

Chapter 2: Linked Lists

2.1 Remove Dups
83. Remove Duplicates from Sorted List (solve it as if list is unsorted)

2.2 Return Kth to Last
19. Remove Nth Node From End of List

2.3 Delete Middle Node
237. Delete Node in a Linked List

2.4 Partition
86. Partition List

2.5 Sum Lists
2. Add Two Numbers

2.6 Palindrome
234. Palindrome Linked List

2,7 Intersection
160. Intersection of Two Linked Lists

2.8 Loop Detection
141. Linked List Cycle

Chapter 3: Stacks and Queues

3.1 Three In One
404

3.2 Stack Min
155. Min Stack

3.3 Stack of Plates
1172. Dinner Plate Stacks (more difficult version)

3.4 Queue via Stacks
232. Implement Queue using Stacks

3.5 Sort Stacks
404

3.6 Animal Shelter
404

Chapter 4: Trees and Graphs

4.1 Route Between Nodes
797. All Paths From Source to Target (more difficult version)
176. Route Between Two Nodes in Graph (Lintcode)

4.2 Minimal Tree
Convert Sorted Array to Binary Search Tree

4.3 List of Depths
242. Convert Binary Tree to Linked Lists by Depth (Lintcode) 114. Flatten Binary Tree to Linked List (different variation)

4.4 Check Balanced
110. Balanced Binary Tree

4.5 Validate BST
98. Validate Binary Search Tree

4.6 Successor
285. Inorder Successor in BST II (Leetcode Premium)

4.7 Build Order
207. Course Schedule (easier version) 210. Course Schedule II

4.8 First Common Ancestor
236. Lowest Common Ancestor of a Binary Tree

4.9 BST Sequences
BST: All Possible Arrays (Not entirely sure what this problem is trying to ask but here's a OJ version of it)
95. Unique Binary Search Trees II ( different variation) 96. Unique Binary Search Trees

4.10 Check Subtree
572. Subtree of Another Tree

4.11 Random Node
Select a Random Node from a tree with equal probability (GeeksForGeeks)

4.12 Paths with Sum
437. Path Sum III

Chapter 8: Recursion and Dynamic Programming

8.1 Triple Step
70. Climbing Stairs (similar…)

8.2 Robot in a Grid
62. Unique Paths (easier) 63. Unique Paths II

8.3 Magic Index
404

8.4 Power Set
78. Subsets

8.5 Recursive Multiply
43. Multiply Strings ( not the same question, but still solvable in the way the question is asking)

8.6 Towers of Nanoi
169. Tower of Hanoi (Lintcode)

8.7 Permutation without Dups
46. Permutations

8.8 Permutation with Duplicates
47. Permutations II

8.9 Paren
22. Generate Parentheses

8.10 Paint Fill
733. Flood Fill

8.11 Coins
518. Coin Change 2 322. Coin Change (to find the fewest coins to make the change) 39. Combination Sum (to print out the actual combinations)

8.12 Eight Queens
51. N-Queens

8.13 Stack of Boxes
Box Stacking Problem (more difficult) (InterviewBit)

Chapter 10: Sorting and Searching

10.1 Sorted Merge
88. Merge Sorted Array

10.2 Group Anagrams
49. Group Anagrams

10.3 Search in Rotated Array
33. Search in Rotated Sorted Array

10.4 Sorted Search, No Size
[278. First Bad Version] (https://leetcode.com/problems/first-bad-version/) (slightly different)

10.5 Sparse Search
404

10.6 Sort Big File
404

10.7 Missing Int
268. Missing Number (easier version)

10.8 Find Duplicates
287. Find the Duplicate Number

10.9 Sorted Matrix Search
74. Search a 2D Matrix

10.10 Rank from Stream
703. Kth Largest Element in a Stream (easier version)

10.11 Peaks and Valleys
376. Wiggle Subsequence (similar question)

leetcodeinterview prepbinary treetreegraphlinkedlistarraystackqueuebit manipulation

Paper Study - Weight Agnostic Neural Networks

Binary Tree Interview Questions