HackerRank Content
Interview Preparation Kit
These are my solution write-ups for the Interview Preparation Kit problems on HackerRank. In general, I assume you are familiar and comfortable with the syntax of the language you want to use, so I focus more on algorithm design. I provide example implementations of my solutions in Java, C++, and Python 3 that passed all test cases at the time of writing.
Name | Category | Difficulty |
---|---|---|
Sales by Match | Warm-up Challenges | Easy |
Counting Valleys | Warm-up Challenges | Easy |
Jumping on the Clouds | Warm-up Challenges | Easy |
Repeated String | Warm-up Challenges | Easy |
2D Array - DS | Arrays | Easy |
Arrays: Left Rotation | Arrays | Easy |
New Year Chaos | Arrays | Medium |
Minimum Swaps 2 | Arrays | Medium |
Hash Tables: Ransom Note | Dictionaries and Hashmaps | Easy |
Two Strings | Dictionaries and Hashmaps | Easy |
Sherlock and Anagrams | Dictionaries and Hashmaps | Medium |
Count Triplets | Dictionaries and Hashmaps | Medium |
Frequency Queries | Dictionaries and Hashmaps | Medium |
Sorting: Bubble Sort | Sorting | Easy |
Mark and Toys | Sorting | Easy |
Sorting: Comparator | Sorting | Medium |
Fraudulent Activity Notifications | Sorting | Medium |
Strings: Making Anagrams | String Manipulation | Easy |
Alternating Characters | String Manipulation | Easy |
Sherlock and the Valid String | String Manipulation | Medium |
Special String Again | String Manipulation | Medium |
Common Child | String Manipulation | Medium |
Minimum Absolute Difference in an Array | Greedy Algorithms | Easy |
Luck Balance | Greedy Algorithms | Easy |
Greedy Florist | Greedy Algorithms | Medium |
Max Min | Greedy Algorithms | Medium |
Hash Tables: Ice Cream Parlor | Search | Medium |
Swap Nodes [Algo] | Search | Medium |
Pairs | Search | Medium |
Triple Sum | Search | Medium |
Minimum Time Required | Search | Medium |
Max Array Sum | Dynamic Programming | Medium |
Abbreviation | Dynamic Programming | Medium |
Candies | Dynamic Programming | Medium |
Balanced Brackets | Stacks and Queues | Medium |
Queues: A Tale of Two Stacks | Stacks and Queues | Medium |
Largest Rectangle | Stacks and Queues | Medium |
Min Max Riddle | Stacks and Queues | Medium |
Castle on the Grid | Stacks and Queues | Medium |
Roads and Libraries | Graphs | Medium |
Find the Nearest Clone | Graphs | Medium |
Tree: Height of a Binary Tree | Trees | Easy |
Binary Search Tree: Lowest Common Ancestor | Trees | Easy |
Trees: Is This a Binary Search Tree? | Trees | Medium |
Tree: Huffman Decoding | Trees | Medium |
Insert a Node at a Specific Position in a Linked List | Linked Lists | Easy |
Inserting a Node into a Sorted Doubly Linked List | Linked Lists | Easy |
Reverse a Doubly Linked List | Linked Lists | Easy |
Find Merge Point of Two Lists | Linked Lists | Easy |
Linked Lists: Detect a Cycle | Linked Lists | Easy |
Recursion: Fibonacci Numbers | Recursion and Backtracking | Easy |
Recursion: Davis' Staircase | Recursion and Backtracking | Medium |
Flipping Bits | Miscellaneous | Easy |