/Interview_solutions

Efficient solutions to must-know interview problems

Most interviewers select their questions from LeetCode, so do the LeetCode questions first. The remaining questions below are either not on LeetCode for free, or are a better version of a LeetCode question.

LeetCode

LeetCode solutions

LeetFree

# Question Solution Difficulty Great Problem
694 Number of Distinct Islands Solution Medium *
711 Number of Distinct Islands II Solution Hard

Cracking the Coding Interview

Section Question Solution Difficulty Great Problem
1.1 Is Unique Solution Easy *
1.3 URLify Solution Easy *
1.4 Palindrome Permutation Solution Easy *
1.5 One Away Solution Medium *
1.9 String Rotation Solution Easy
2.1 Remove Dups Solution Easy *
2.4 Partition Solution Medium *
3 - Intro Implement a Stack Solution Easy *
3 - Intro Implement a Queue Solution Easy *
3.1 Three in One Solution Medium
3.2 Stack Min Solution Medium *
3.4 Queue via Stacks Solution Medium *
3.5 Sort Stack Solution Medium *
4 - Intro Implement a TreeNode Solution Easy *
4 - Intro Implement a GraphNode Solution Easy *
4 - Intro Breadth-First Search (BFS) Solution Medium *
4 - Intro Depth-First Search (DFS) Solution Medium *
4.01 Route Between Nodes Solution Easy *
4.05 Validate BST Solution Medium *
4.06 Successor Solution Medium *
4.07 Build Order Solution Hard *
4.09 BST Sequences Solution Hard
4.11 Random Node Solution Hard *
5 - Intro BitFunctions: getBit Solution Easy
5 - Intro BitFunctions: setBit Solution Easy
5 - Intro BitFunctions: clearBit Solution Easy
5.2 Binary to String Solution Medium
5.3 Flip Bit to Win Solution Medium
5.4 Next Number Solution Hard
5.6 Conversion Solution Easy
5.7 Pairwise Swap Solution Medium
6 - Intro Prime - isPrime Solution Easy
7.09 Circular Array Solution Medium *
8.02 Robot in a Grid Solution Hard
8.03 Magic Index Solution Medium *
8.05 Recursive Multiply Solution Medium *
8.06 Towers of Hanoi Solution Hard *
8.13 Stack of Boxes Solution Hard *
10 - Intro Merge Sort Solution Hard
10.04 Sorted Search No Size Solution Medium *
10.06 Sort Big File Solution Medium *
10.07 Missing Int Solution Hard
10.08 Find Duplicates Solution Easy *
10.10 Rank from Stream Solution Hard *
10.11 Peaks and Valleys Solution Easy *
13.5 TreeMap, HashMap, LinkedHashMap Solution Easy *
16.01 Number Swapper Solution Medium
16.04 Tic Tac Win Solution Medium *
16.06 Smallest Difference Solution Medium *
16.10 Living People Solution Medium *
16.11 Diving Board Solution Easy *
16.15 Master Mind Solution Medium
16.18 Pattern Matching Solution Hard *
16.19 Pond Sizes Solution Medium *
16.20 T9 Solution Medium *
16.21 Sum Swap Solution Medium *
16.22 Langtons Ant Solution Easy *
17.03 Random Set Solution Hard *
17.07 Baby Names Solution Easy *
17.11 Word Distance Solution Medium *
17.12 BiNode Solution Hard *
17.14 Smallest K Solution Medium *
17.15 Longest Word Solution Hard *
17.16 The Masseuse Solution Medium *
17.18 Shortest Supersequence Solution Hard *
17.19 Missing Two Solution Medium *
17.24 Max Submatrix Solution Hard *

HackerRank

Question Solution Difficulty Great Problem
Linked List - Print in Reverse Solution Easy *
Counting Sort Solution Medium *
Reverse a Doubly Linked List Solution Medium *
Java 1D Array Solution Medium *
Java Dequeue Solution Medium *
Contacts Solution Hard *
Array Manipulation Solution Hard *
Picking Numbers Solution Easy *
Electronics Shop Solution Easy
Minimum Distances Solution Easy
Find Digits Solution Easy
Sansa and XOR Solution Easy
Making Anagrams Solution Medium
Repeated String Solution Medium
Inserting a Node Into a Sorted Doubly Linked List Solution Medium
Super Reduced String Solution Medium
Caesar Cipher Solution Medium
Gemstones Solution Medium
Maximizing XOR Solution Medium
Sum vs XOR Solution Hard

Custom

Question Solution Difficulty Great Problem
Dijkstra's Algorithm Solution Hard *
Arithmetic Progression Missing Element Solution Easy
Shortest Common SuperSequence Solution Hard
2 Coins on Graph Solution Medium
Find Cycles in Graph Solution Medium
Shortest Cycle in Graph Containing Given Node Solution Medium
Risky Edges in Graph Solution Medium
Number of Shortest Paths Solution Medium
Ethnographers Births and Deaths Solution Medium
Adding and Removing Edges in MSTs Solution Medium