HackerRank
HackerRank copied to clipboard
HackerRank solutions in Java/JS/Python/C++/C#
Solutions to problems on HackerRank.
Check out HackerRank's new format here
If you are interested in helping or have a solution in a different language feel free to make a pull request.
Algorithms 
- Warmup
- Implementation
- Strings
- Sorting
- Search
- Graph Theory
- Greedy
- Dynamic Programming
- Constructive Algorithms
- Bit Manipulation
- Recursion
- Game Theory
- NP Complete
DataStructures 
- Arrays
- Linked Lists
- Trees
- Balanced Trees
- Stacks
- Queues
- Heap
- Disjoint Set
- Multiple Choice
- Trie
- Advanced
Mathematics 
- Fundamentals
- Number Theory
- Combinatorics
- Algebra
- Geometry
- Probability
- Linear Algebra Foundations
Java 
- Introduction
- Strings
- BigNumber
- Data Structures
- Object Oriented Programming
- Exception Handling
- Advanced
Warmup
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Solve Me First |
|
O(1) | O(1) | Easy | 1 | ||
| Simple Array Sum |
|
O(n) | O(1) | Easy | 10 | ||
| Compare the Triplets |
|
O(1) | O(1) | Easy | 10 | ||
| A Very Big Sum |
|
O(n) | O(1) | Easy | 10 | ||
| Diagonal Difference |
|
O(n) | O(1) | Easy | 10 | ||
| Plus Minus |
|
O(n) | O(1) | Easy | 10 | ||
| Staircase |
|
O(n) | O(n) | Easy | 10 | ||
| Mini-Max Sum |
|
O(1) | O(1) | Easy | 10 | ||
| Time Conversion |
|
O(1) | O(1) | Easy | 15 | ||
| Birthday Cake Candles |
|
O(n) | O(1) | Easy | 10 |
Implementation
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Grading Students |
|
O(n) | O(1) | Easy | 10 | ||
| Apple and Orange |
|
O(n+m) | O(1) | Easy | 10 | ||
| Kangaroo |
|
O(1) | O(1) | Easy | 10 | ||
| Between Two Sets |
|
O(x(n+m)) | O(1) | Easy | 10 | x=(max(m) - min(n))/min(n) | |
| Divisible Sum Pairs |
|
O(n^2) | O(1) | Easy | 10 | ||
| Birthday Chocolate |
|
O(n) | O(1) | Easy | 10 | ||
| Breaking the Records |
|
O(n) | O(1) | Easy | 10 | ||
| Migratory Birds |
|
O(n) | O(1) | Easy | 10 | ||
| Day of the Programmer |
|
O(1) | O(1) | Easy | 15 | ||
| Bon Appetit |
|
O(n) | O(1) | Easy | 10 | ||
| Sock Merchant |
|
O(n) | O(n) | Easy | 10 | ||
| Drawing Book |
|
O(1) | O(1) | Easy | 10 | ||
| Counting Valleys |
|
O(n) | O(1) | Easy | 15 | ||
| Cats and a Mouse |
|
O(1) | O(1) | Easy | 15 | ||
| Electronics Shop |
|
O(n log (n)) | O(1) | Easy | 15 | n = m+n | |
| Picking Numbers |
|
O(n) | O(n) | Easy | 20 | ||
| Climbing the Leaderboard |
|
O(n+m) | (n) | Easy | 20 | ||
| The Hurdle Race |
|
O(n) | O(1) | Easy | 15 | ||
| Designer PDF Viewer |
|
O(n) | O(n) | Easy | 20 | ||
| Forming a Magic Square |
|
O(1) | O(1) | Easy | 20 | ||
| Utopian Tree |
|
O(n) | O(1) | Easy | 20 | ||
| Angry Professor |
|
O(n) | O(1) | Easy | 20 | ||
| Beautiful Days at the Movies |
|
O(n) | O(1) | Easy | 15 | ||
| Viral Advertising |
|
O(n) | O(1) | Easy | 15 | ||
| Save the Prisoner! |
|
O(1) | O(1) | Easy | 15 | ||
| Circular Array Rotation |
|
O(n) | O(1) | Easy | 20 | ||
| Sequence Equation |
|
O(n) | O(n) | Easy | 20 | ||
| Jumping on the Clouds: Revisited |
|
O(n) | O(n) | Easy | 15 | ||
| Find Digits |
|
O(n) | O(1) | Easy | 25 | ||
| Extra Long Factorials |
|
O(n) | O(1) | Medium | 20 | ||
| Append and Delete |
|
O(n) | O(1) | Easy | 20 | ||
| Sherlock and Squares |
|
O(n) | O(1) | Easy | 20 | ||
| Library Fine |
|
O(1) | O(1) | Easy | 15 | ||
| Cut the sticks |
|
O(n log(n)) | O(n) | Easy | 25 | ||
| Non-Divisible Subset |
|
O(n) | O(n) | Medium | 20 | ||
| Repeated String |
|
O(n) | O(n) | Easy | 20 | ||
| Jumping on the Clouds |
|
O(n) | O(n) | Easy | 20 | ||
| Equalize the Array |
|
O(n) | O(n) | Easy | 20 | ||
| Queen's Attack II |
|
O(k) | O(1) | Medium | 30 | ||
| ACM ICPC Team |
|
O(n^3) | O(n) | Easy | 25 | ||
| Taum and B'day |
|
O(1) | O(1) | Easy | 25 | ||
| Organizing Containers of Balls |
|
O(n^2) | O(n^2) | Medium | 30 | ||
| Encryption |
|
O(n) | O(1) | Medium | 30 | ||
| Bigger is Greater |
|
O(n) | O(n) | Medium | 35 | ||
| Modified Kaprekar Numbers |
|
O(n) | O(1) | Easy | 30 | ||
| Minimum Distances |
|
O(n) | O(n) | Easy | 20 | ||
| Beautiful Triplets |
|
O(n) | O(n) | Easy | 20 | ||
| Strings: Making Anagrams |
|
O(|a|+|b|) | O(1) | Easy | 30 | ||
| The Time in Words |
|
O(1) | O(1) | Medium | 25 | ||
| Chocolate Feast |
|
O(log(n)) | O(1) | Easy | 25 | Base of logarithmic time complexity is m | |
| Service Lane |
|
O(n) | O(n) | Easy | 20 | ||
| Lisa's Workbook |
|
O(n) | O(1) | Easy | 25 | ||
| Flatland Space Stations |
|
O(n) | O(n) | Easy | 25 | ||
| Fair Rations |
|
O(n) | O(1) | Easy | 25 | ||
| Cavity Map |
|
O(n^2) | O(n^2) | Easy | 30 | ||
| Manasa and Stones |
|
O(n) | O(1) | Easy | 30 | ||
| The Grid Search |
|
O(n) | O(n) | Medium | 30 | n = len(word) | |
| Happy Ladybugs |
|
O(n) | O(n) | Easy | 30 | ||
| Strange Counter |
|
O(n) | O(1) | Easy | 30 | n = t | |
| Absolute Permuation |
|
O(n) | O(n) | Medium | 40 | ||
| The Bomberman Game |
|
O(n*m) | O(n*m) | Medium | 40 | ||
| Ema's Supercomputer |
|
Medium | 40 | ||||
| Larry's Array |
|
Medium | 40 | ||||
| Almost Sorted |
|
Medium | 50 | ||||
| Matrix Layer Rotation |
|
O(n*m) | O(n*m) | Hard | 80 | ||
| Consecutive 1s in Binary Numbers |
|
O(n) | O(1) | Easy | 30 | ||
| Nested Logic |
|
O(1) | O(1) | Easy | 40 | ||
| Bitwise AND |
|
O(1) | O(1) | Easy | 20 |
Strings
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Super Reduced String |
|
O(n) | O(n) | Easy | 10 | ||
| camelCase |
|
O(n) | O(1) | Easy | 15 | ||
| Strong Password |
|
O(n) | O(1) | Easy | 15 | ||
| Two Characters |
|
O(n) | O(n) | Easy | 15 | ||
| Caesar Cipher |
|
O(n) | O(n) | Easy | 15 | ||
| Caesar Cipher: Encryption |
|
O(n) | O(n) | Easy | 40 | ||
| Mars Exploration |
|
O(n) | O(1) | Easy | 15 | ||
| HackerRank in a String! |
|
O(n) | O(1) | Easy | 20 | ||
| Pangrams |
|
O(n) | O(1) | Easy | 20 | ||
| Weighted Uniform Strings |
|
O(n) | O(n) | Easy | 20 | ||
| Separate the Numbers |
|
O(n) | O(n) | Easy | 20 | ||
| Funny String |
|
O(n) | O(n) | Easy | 25 | ||
| Gemstones |
|
O(n) | O(1) | Easy | 20 | ||
| Alternating Characters |
|
O(n) | O(1) | Easy | 20 | ||
| Beautiful Binary String |
|
O(n) | O(1) | Easy | 20 | ||
| The Love-Letter Mystery |
|
O(n) | O(1) | Easy | 20 | ||
| Determining DNA Health |
|
Hard | 50 | ||||
| Palindrome Index |
|
O(n) | O(1) | Easy | 25 | ||
| Anagram |
|
O(n) | O(1) | Easy | 25 | ||
| Making Anagrams |
|
O(n) | O(n) | Easy | 30 | ||
| Game of Thrones - I |
|
O(n) | O(1) | Easy | 30 | ||
| Two Strings |
|
O(|a| + |b|) | O(1) | Easy | 25 | a and b are lengths of the input strings | |
| String Construction |
|
O(n) | O(n) | Easy | 25 | ||
| Sherlock and Valid String |
|
O(n) | O(n) | Hard | 100 | ||
| Richie Rich |
|
O(n) | O(n) | Medium | 30 | ||
| Sherlock and Anagrams |
|
Medium | 50 | ||||
| Common Child |
|
Hard | 60 | ||||
| Bear and Steady Gene |
|
Medium | 50 | ||||
| Morgan and a String |
|
O((|a|+|b|)^2) | O(|a| + |b|) | Expert | 100 | ||
| Count Strings |
|
Hard | 80 | ||||
| String Function Calculation |
|
Advanced | 80 | ||||
| Build a Palindrome |
|
Advanced | 80 | ||||
| Build a String |
|
Hard | 80 | ||||
| Gridland Provinces |
|
Hard | 80 | ||||
| Ashton and String |
|
Advanced | 100 | ||||
| String Similarity |
|
Expert | 100 | ||||
| Super Functional Strings |
|
Advanced | 80 | ||||
| Circular Palindromes |
|
Advanced | 120 | ||||
| Similar Strings |
|
Advanced | 85 | ||||
| Save Humanity |
|
Expert | 100 | ||||
| Find Strings |
|
Expert | 100 | ||||
| Palindromic Border |
|
Expert | 100 | ||||
| Two Two |
|
Advanced | 150 | ||||
| Two Strings Game |
|
Expert | 100 | ||||
| Letter Islands |
|
Expert | 100 | ||||
| Pseudo-Isomorphic Substrings |
|
Expert | 100 | ||||
| How Many Substrings? |
|
Expert | 100 |
Sorting
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Intro to Tutorial Challenges |
|
O(n) | O(1) | Easy | 30 | ||
| Insertion Sort - Part 1 |
|
O(n) | O(1) | Easy | 30 | ||
| Insertion Sort - Part 2 |
|
O(n^2) | O(1) | Easy | 30 | ||
| Correctness and the Loop Invariant |
|
O(n^2) | O(1) | Easy | 30 | ||
| Running Time of Algorithms |
|
O(n^2) | O(1) | Easy | 30 | ||
| Quicksort 1 - Partition |
|
O(n) | O(n) | Easy | 10 | ||
| Quicksort 2 - Sorting |
|
O(n^2) | O(n) | Easy | 30 | ||
| Quicksort In-Place |
|
O(n^2) | O(log(n)) | Medium | 35 | ||
| Running Time of Quicksort |
|
O(n log(n)) | O(log(n)) | Easy | 35 | ||
| Counting Sort 1 |
|
O(n+k) | O(k) | Easy | 30 | value of k in this problem is 100 | |
| Counting Sort 2 |
|
O(n+k) | O(n+k) | Easy | 30 | Value of k is 100 in this problem. | |
| Counting Sort 3 |
|
O(n+k) | O(k) | Easy | 30 | ||
| The Full Counting Sort |
|
O(n+k) | O(n+k) | Medium | 40 | ||
| Closest Numbers |
|
O(n log(n)) | O(n) | Easy | 35 | ||
| Find the Median |
|
O(n log(n)) | O(n) | Easy | 35 | ||
| Insertion Sort Advanced Analysis |
|
Advanced | 50 | ||||
| Fraudulent Activity Notifications |
|
O(n^2) | O(n) | Medium | 40 | ||
| Lily's Homework |
|
O(n log(n)) | O(n) | Medium | 40 | ||
| Big Sorting |
|
O(n log(n)) | O(n) | Easy | 20 |
Search
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Hackerland Radio Transmitters |
|
O(n log(n)) | O(n) | Medium | 25 | ||
| Ice Cream Parlor |
|
O(n) | O(n) | Easy | 30 | ||
| Binary Search: Ice Cream Parlor |
|
O(n) | O(n) | Easy | 35 | ||
| Gridland Metro |
|
O(k) | O(k) | Medium | 25 | k = number of tracks | |
| Missing Numbers |
|
O(n) | O(n) | Easy | 45 | ||
| Minimum Loss |
|
O(n log(n)) | O(n) | Medium | 35 | ||
| KnightL on a Chessboard |
|
Medium | 35 | ||||
| Pairs |
|
O(n log(n)) | O(n) | Medium | 50 | ||
| Sherlock and Array |
|
O(n) | O(n) | Easy | 40 | ||
| Maximum Subarray Sum |
|
Hard | 65 | ||||
| Connected Cells in a grid |
|
Medium | 50 | ||||
| Short Palindrome |
|
Medium | 40 | ||||
| Maximizing Mission Points |
|
Hard | 70 | ||||
| Count Luck |
|
Medium | 50 | ||||
| Cut the Tree |
|
Medium | 50 | ||||
| Making Candies |
|
Hard | 45 | ||||
| Gena Playing Hanoi |
|
Medium | 50 | ||||
| Beautiful Quadruples |
|
Medium | 50 | ||||
| Bike Racers |
|
Hard | 65 | ||||
| Task Scheduling |
|
Advanced | 70 | ||||
| Similar Pair |
|
Advanced | 70 | ||||
| Absolute Element Sums |
|
Hard | 70 | ||||
| Sorted Subsegments |
|
Hard | 80 | ||||
| Distant Pairs |
|
Expert | 80 | ||||
| King Richard's Knights |
|
Hard | 80 |
Graph Theory
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Roads and Libraries |
|
Medium | 30 | ||||
| Synchronous Shopping |
|
Medium | 40 | ||||
| Crab Graphs |
|
Medium | 50 | ||||
| Even Tree |
|
Medium | 50 | ||||
| Snakes and Ladders: The Quickest Way Up |
|
Medium | 50 | ||||
| Subset Component |
|
Hard | 50 | ||||
| Journey to the Moon |
|
O(n + i) | O(n) | Medium | 50 | ||
| Kruskal (MST): Really Special Subtree |
|
Hard | 50 | ||||
| Minimum Penalty Path |
|
Medium | 50 | ||||
| Demanding Money |
|
Hard | 50 | ||||
| The Story of a Tree |
|
Medium | 50 | ||||
| Breadth First Search: Shortest Reach |
|
Medium | 55 | ||||
| The Value of Friendship |
|
Hard | 55 | ||||
| Clique |
|
Medium | 60 | ||||
| Dijkstra: Shortest Reach 2 |
|
Hard | 60 | ||||
| Prim's (MST) : Special Subtree |
|
Medium | 60 | ||||
| Roads in Hackerland |
|
Medium | 60 | ||||
| Toll Cost Digits |
|
Hard | 60 | ||||
| Real Estate Broker |
|
Hard | 60 | ||||
| Matrix |
|
Hard | 70 | ||||
| Bead Ornaments |
|
Advanced | 70 | ||||
| Rust & Murderer |
|
O(n+m) | O(n) | Medium | 70 | ||
| Recording Episodes |
|
Hard | 70 | ||||
| Kingdom Connectivity |
|
Hard | 75 | ||||
| Journey Scheduling |
|
Hard | 75 | ||||
| Floyd : City of Blinding Lights |
|
Hard | 75 | ||||
| Find the Path |
|
Hard | 75 | ||||
| Repair Roads |
|
Hard | 80 | ||||
| Problem solving |
|
Hard | 80 | ||||
| Computer Game |
|
Hard | 80 | ||||
| Jack goes to Rapture |
|
Medium | 80 | ||||
| Jim and his LAN Party |
|
Hard | 80 | ||||
| Jeanie's Route |
|
Medium | 80 | ||||
| Travel in HackerLand |
|
Hard | 80 | ||||
| Jogging Cats |
|
Advanced | 80 | ||||
| Tree Flow |
|
Hard | 80 | ||||
| Tripartite Matching |
|
Hard | 80 | ||||
| Jumping Rooks |
|
Advanced | 80 | ||||
| Minimum MST Graph |
|
Expert | 80 | ||||
| Coprime Paths |
|
Expert | 80 | ||||
| DAG Queries |
|
Expert | 80 | ||||
| Liars |
|
Advanced | 85 | ||||
| ByteLandianTours |
|
Hard | 90 | ||||
| Kth Ancestor |
|
Hard | 90 | ||||
| Drive |
|
Expert | 90 | ||||
| Road Network |
|
Expert | 90 | ||||
| Savita And Friends |
|
Hard | 90 | ||||
| Favorite sequence |
|
Advanced | 95 | ||||
| Quadrant Queries |
|
Advanced | 100 | ||||
| Going to the Office |
|
Expert | 100 | ||||
| Ticket |
|
Expert | 100 | ||||
| HackerX |
|
Hard | 100 | ||||
| Hacker Country |
|
Hard | 100 | ||||
| Travelling Salesman in a Grid |
|
Expert | 100 | ||||
| Huarongdao |
|
Expert | 100 | ||||
| Vertical Paths |
|
Expert | 100 | ||||
| DFS Edges |
|
Expert | 100 | ||||
| Tree Splitting |
|
Advanced | 100 | ||||
| Definite Random Walks |
|
Expert | 100 | ||||
| Diameter Minimization |
|
Expert | 100 | ||||
| Training the army |
|
Hard | 120 | ||||
| Alex vs Fedor |
|
Expert | 150 |
Greedy
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Minimum Absolute Difference in an Array |
|
O(n log(n)) | O(n) | Easy | 15 | ||
| Chief Hopper |
|
O(n) | O(n) | Hard | 65 | ||
| Mark and Toys |
|
O(n log(n)) | O(n) | Easy | 35 | ||
| Marc's Cakewalk |
|
O(n + k) | O(k) | Easy | 15 | ||
| Grid Challenge |
|
O(n*(n log (n))) | O(n^2) | Easy | 20 | ||
| Luck Balance |
|
O(n log(n)) | O(1) | Easy | 20 | ||
| Maximum Perimeter Triangle |
|
O(n log (n)) | O(n) | Easy | 20 | ||
| Permuting Two Arrays |
|
O(n log (n)) | O(n) | Easy | 40 | ||
| Jim and the Orders |
|
O(n log (n)) | O(n) | Easy | 40 | ||
| Equal Stacks |
|
O(n) | O(n) | Easy | 25 | ||
| Sherlock and The Beast |
|
O(n) | O(n) | Easy | 30 | ||
| Priyanka and Toys |
|
O(n log(n)) | O(n) | Easy | 30 | ||
| Largest Permutation |
|
O(n) | O(n) | Easy | 30 | ||
| Beautiful Pairs |
|
Easy | 30 | ||||
| Yet Another Minimax Problem |
|
Medium | 20 | ||||
| Flipping the Matrix |
|
O(n^2) | O(n^2) | Medium | 30 | ||
| Roads and Libraries |
|
Medium | 30 | ||||
| Greedy Florist |
|
O(n log (n)) | O(n) | Medium | 35 | ||
| Mark and Toys |
|
O(n log(n)) | O(n) | Easy | 35 | ||
| Max Min |
|
O(n log(n)) | O(1) | Medium | 35 | ||
| Permuting Two Arrays |
|
Easy | 40 | ||||
| Jim and the Orders |
|
Easy | 40 | ||||
| Goodland Electricity |
|
Medium | 40 | ||||
| Fun Game |
|
Medium | 40 | ||||
| Reverse Shuffle Merge |
|
Advanced | 50 | ||||
| Cutting Boards |
|
Hard | 60 | ||||
| Algorithmic Crush |
|
Hard | 60 | ||||
| Prim's (MST): Special Subtree |
|
Medium | 60 | ||||
| Accessory Collection |
|
Hard | 60 | ||||
| Chief Hopper |
|
O(n) | O(n) | Hard | 65 | ||
| Sherlock and MiniMax |
|
Hard | 70 | ||||
| Team Formation |
|
Advanced | 70 |
Dynamic Programming
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Equal |
|
Medium | 30 | ||||
| Cut Tree |
|
Medium | 40 | ||||
| Mr K marsh |
|
Medium | 40 | ||||
| Sam and sub-strings |
|
Medium | 40 | ||||
| Summing Pieces |
|
Medium | 40 | ||||
| Short Palindrome |
|
Medium | 40 | ||||
| Abbreviation |
|
Medium | 40 | ||||
| Fair Cut |
|
Medium | 40 | ||||
| Fibonacci Modified |
|
Medium | 45 | ||||
| Lego Blocks |
|
Medium | 50 | ||||
| Candies |
|
Medium | 50 | ||||
| Stock Maximize |
|
Medium | 50 | ||||
| Angry Childtren 2 |
|
Hard | 50 | ||||
| The Maximum Subarray |
|
Medium | 50 | ||||
| Sherlock and Cost |
|
Medium | 50 | ||||
| Xor and Sum |
|
Medium | 50 | ||||
| Counting Special Sub-Cubes |
|
Medium | 50 | ||||
| Two Robots |
|
Medium | 50 | ||||
| Kingdom Division |
|
Medium | 50 | ||||
| Prime XOR |
|
Medium | 50 | ||||
| HackerRank City |
|
Medium | 50 | ||||
| Nikita and the Game |
|
Medium | 50 | ||||
| Prime Digit Sums |
|
Medium | 50 | ||||
| Mandragora Forest |
|
Medium | 50 | ||||
| LCS Returns |
|
Medium | 50 | ||||
| Grid Walking |
|
Medium | 55 | ||||
| Bricks Game |
|
Medium | 55 | ||||
| The Longest Common Subsequence |
|
Medium | 55 | ||||
| Substring Diff |
|
Medium | 60 | ||||
| Brick Tiling |
|
Hard | 60 | ||||
| Alien Languages |
|
Hard | 60 | ||||
| The Longest Increasing Subsequence |
|
Advanced | 60 | ||||
| The Coin Change Problem |
|
O(N*M) | O(N) | Hard | 60 | ||
| Knapsack |
|
Medium | 60 | ||||
| Sherlock's Array Merging Algorithm |
|
Hard | 60 | ||||
| New Year Game |
|
Medium | 60 | ||||
| Shashank and the Palindromic Strings |
|
Advanced | 60 | ||||
| Decibinary Numbers |
|
Hard | 60 | ||||
| Choosing White Balls |
|
Hard | 60 | ||||
| DP: Coin Change |
|
Hard | 60 | ||||
| Clues on a Binary Path |
|
Hard | 60 | ||||
| GCD Matrix |
|
Hard | 60 | ||||
| Coin on the Table |
|
Medium | 65 | ||||
| Interval Selection |
|
Medium | 65 | ||||
| Red John is Back |
|
Medium | 65 | ||||
| Play with words |
|
Medium | 65 | ||||
| Queens on Board |
|
Hard | 70 | ||||
| String Reduction |
|
Hard | 70 | ||||
| Far Vertices |
|
Hard | 70 | ||||
| The Indian Job |
|
Medium | 70 | ||||
| Hexagonal Grid |
|
Hard | 70 | ||||
| Longest Palindromic Subsequence |
|
Hard | 70 | ||||
| Turn Off the Lights |
|
Hard | 70 | ||||
| Tara's Beautiful Permutations |
|
Hard | 70 | ||||
| Two Subarrays |
|
Expert | 70 | ||||
| Mining |
|
Advanced | 75 | ||||
| The Longest Common Subsequence (LCS) |
|
Hard | 75 | ||||
| Points in a Plane |
|
Advanced | 80 | ||||
| Fairy Chess |
|
Advanced | 80 | ||||
| Billboards |
|
Advanced | 80 | ||||
| Requirement |
|
Advanced | 80 | ||||
| A Super Hero |
|
Hard | 80 | ||||
| Covering the stains |
|
Hard | 80 | ||||
| Superman Celebrates Diwali |
|
Hard | 80 | ||||
| Wet Shark and Two Subsequences |
|
Medium | 80 | ||||
| Zurikela's Graph |
|
Hard | 80 | ||||
| New Year Present |
|
Hard | 80 | ||||
| Suffix Rotation |
|
Expert | 80 | ||||
| Black and White Tree |
|
Hard | 80 | ||||
| Beautiful Strings |
|
Hard | 80 | ||||
| Longest Mod Path |
|
Hard | 80 | ||||
| Super Functional Strings |
|
Advanced | 80 | ||||
| Kitty's Calculations on a Tree |
|
Advanced | 80 | ||||
| Liars |
|
Advanced | 85 | ||||
| Dorsey Thief |
|
Advanced | 85 | ||||
| Swap Permutation |
|
Medium | 85 | ||||
| Candles Counting |
|
Medium | 85 | ||||
| Square Subsequences |
|
Hard | 90 | ||||
| Hyper Strings |
|
Advanced | 90 | ||||
| Unique Divide And Conquer |
|
Advanced | 90 | ||||
| Super Kth LIS |
|
Advanced | 90 | ||||
| Counting Road Networks |
|
Expert | 90 | ||||
| Lucky Numbers |
|
Expert | 100 | ||||
| Count Scorecards |
|
Expert | 100 | ||||
| Unfair Game |
|
Advanced | 100 | ||||
| Oil Well |
|
Hard | 100 | ||||
| Modify The Sequence |
|
Advanced | 100 | ||||
| Divisible Numbers |
|
Expert | 100 | ||||
| Ones and Twos |
|
Hard | 100 | ||||
| Extremum Permutations |
|
Medium | 100 | ||||
| Tree Pruning |
|
Advanced | 100 | ||||
| P-sequences |
|
Hard | 100 | ||||
| Best spot |
|
Advanced | 100 | ||||
| Find the Seed |
|
Advanced | 100 | ||||
| The Blacklist |
|
Advanced | 100 | ||||
| Police Operation |
|
Hard | 100 | ||||
| Road Maintenance |
|
Hard | 100 | ||||
| King and Four Sons |
|
Expert | 100 | ||||
| Counting the Ways |
|
Expert | 100 | ||||
| Hard Disk Drives |
|
Expert | 100 | ||||
| Travel around the world |
|
Medium | 120 | ||||
| Robot |
|
Advanced | 120 | ||||
| Vim War |
|
Advanced | 120 | ||||
| Dortmund Dilemma |
|
Advanced | 150 | ||||
| Separate the chocolate |
|
Expert | 250 |
Constructive Algorithms
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Lena Sort |
|
Medium | 30 | ||||
| Flipping the Matrix |
|
O(n^2) | O(n^2) | Medium | 30 | ||
| Gaming Array |
|
Medium | 35 | ||||
| New Year Chaos |
|
Medium | 40 | ||||
| Bonetrousle |
|
Medium | 50 | ||||
| Yet Another KMP Problem |
|
Hard | 60 | ||||
| Beautiful 3 Set |
|
Hard | 60 | ||||
| Inverse RMQ |
|
Hard | 60 | ||||
| Two Subarrays |
|
Expert | 70 | ||||
| Lovely Triplets |
|
Advanced | 80 | ||||
| Array Construction |
|
Advanced | 80 |
Bit Manipulation
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Lonely Integer |
|
O(n) | O(1) | Easy | 20 | ||
| Maximizing XOR |
|
Easy | 30 | ||||
| Counter game |
|
Medium | 30 | ||||
| Xor-sequence |
|
Medium | 40 | ||||
| Sum vs XOR |
|
O(n log(n)) | O(1) | Easy | 20 | ||
| The Great XOR |
|
Medium | 25 | ||||
| Flipping bits |
|
Easy | 40 | ||||
| Yet Another Minimax Problem |
|
Medium | 30 | ||||
| Sansa and XOR |
|
Medium | 30 | ||||
| AND Product |
|
Medium | 40 | ||||
| Xoring Ninja |
|
Hard | 55 | ||||
| Cipher |
|
Medium | 50 | ||||
| XOR Matrix |
|
Hard | 50 | ||||
| What's Next? |
|
Medium | 50 | ||||
| String Transmission |
|
Hard | 60 | ||||
| A or B |
|
Medium | 50 | ||||
| Manipulative Numbers |
|
Hard | 55 | ||||
| Stone game |
|
Hard | 70 | ||||
| 2's complement |
|
Advanced | 70 | ||||
| Changing Bits |
|
Advanced | 70 | ||||
| XOR key |
|
Advanced | 80 | ||||
| Maximizing the Function |
|
Hard | 70 | ||||
| XOR Subsequences |
|
Advanced | 80 | ||||
| Iterate It |
|
Expert | 90 | ||||
| Hamming Distance |
|
Expert | 150 | ||||
| Mixing proteins |
|
Hard | 80 |
Recursion
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| The Power Sum |
|
Easy | 20 | ||||
| Crossword Puzzle |
|
Medium | 30 | ||||
| Recursive Digit Sum |
|
Medium | 30 | ||||
| Simplified Chess Engine |
|
Medium | 40 | ||||
| Password Cracker |
|
Medium | 40 | ||||
| Artithmetic Expressions |
|
Hard | 40 | ||||
| K Factorization |
|
Hard | 50 | ||||
| Bowling Pins |
|
Advanced | 60 | ||||
| Simplified Chess Engine II |
|
Hard | 60 | ||||
| Repetitive K-Sums |
|
Advanced | 150 |
Game Theory
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Game of Stones |
|
O(n) | O(1) | Easy | 15 | ||
| Tower Breakers |
|
Easy | 15 | ||||
| A Chessboard Game |
|
Easy | 15 | ||||
| Introduction to Nim Game |
|
Easy | 15 | ||||
| Misère Nim |
|
Easy | 20 | ||||
| Nimble Game |
|
Easy | 20 | ||||
| Alice and Bob's Silly Game |
|
Medium | 30 | ||||
| Poker Nim |
|
Easy | 20 | ||||
| Tower Breakers, Revisited! |
|
Medium | 25 | ||||
| Tower Breakers, Again! |
|
Medium | 30 | ||||
| Zero-Move Nim |
|
Medium | 50 | ||||
| Chessboard Game, Again! |
|
Medium | 30 | ||||
| Digits Square Board |
|
Medium | 35 | ||||
| Fun Game |
|
Medium | 40 | ||||
| Stone Division |
|
Hard | 50 | ||||
| Chocolate in Box |
|
Medium | 70 | ||||
| Kitty and Katty |
|
Medium | 80 | ||||
| Powers Game |
|
Medium | 50 | ||||
| Deforestation |
|
Medium | 50 | ||||
| Bob and Ben |
|
Medium | 50 | ||||
| Tower Breakers - The Final Battle |
|
Medium | 50 | ||||
| Simple Game |
|
Hard | 60 | ||||
| Permutation game |
|
Medium | 70 | ||||
| Move the Coins |
|
Hard | 60 | ||||
| Play on benders |
|
Medium | 70 | ||||
| New Year Game |
|
Medium | 60 | ||||
| Stone Piles |
|
Hard | 80 | ||||
| Chocolate Game |
|
Hard | 90 | ||||
| Manasa and Prime game |
|
Hard | 90 | ||||
| Vertical Rooks |
|
Medium | 90 | ||||
| A stones game |
|
Medium | 90 | ||||
| Tastes Like Winning |
|
Expert | 100 |
NP Complete
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Walking the Approximate Longest Path |
|
Hard | 70 | ||||
| Sam's Puzzle (Approximate) |
|
Advanced | 85 | ||||
| Spies, Revised |
|
Expert | 100 | ||||
| TBS Problem |
|
Expert | 100 |
Object Oriented Programming
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Class vs. Instance |
|
N/A | N/A | Easy | 30 | ||
| Inheritance |
|
O(n) | O(1) | Easy | 30 | ||
| Abstract Classes |
|
N/A | N/A | Easy | 30 | ||
| Complex Numbers |
|
O(1) | O(1) | Easy | 30 |
Arrays
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Arrays - DS |
|
O(n) | O(n) | Easy | 10 | ||
| 2D Array - DS |
|
O(1) | O(1) | Easy | 15 | ||
| Sparse Arrays |
|
O(n + q) | O(n + q) | Medium | 25 | n = number of input strings, q = number of queries | |
| Dynamic Array |
|
O(q) | O(n) | Easy | 15 | q = Number of queries |
Linked Lists
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Print the Elements of a Linked List |
|
O(n) | O(1) | Easy | 5 | ||
| Reverse a Linked List |
|
O(n) | O(1) | Easy | 5 | ||
| Compare Two Linked Lists |
|
O(n) | O(1) | Easy | 5 | ||
| Delete a node |
|
O(n) | O(1) | Easy | 5 |
Trees
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Tree: Preorder Traversal |
|
O(n) | O(n) | Easy | 10 | ||
| Swap Nodes [Algo] |
|
O(n) | O(n) | Medium | 40 |
Balanced Trees
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Self Balancing Tree |
|
O(log(n)) | O(n) | Medium | 50 |
Stacks
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Maximum Element |
|
Push-O(1), Delete - O(n), Print - O(1) | Push - O(1), Delete - O(1), Print - O(1) | Easy | 20 | ||
| Balanced Brackets |
|
O(n) | O(n) | Medium | 25 |
Queues
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Queue using Two Stacks |
|
Enqueue - O(1), Dequeue - O(n), Print - O(n) | Enqueue - O(1), Dequeue - O(1), Print - O(1) | Medium | 30 |
Heap
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| QHEAP1 |
|
Insert - O(log(n)), Delete - O(n), Print - O(1) | Insert - O(1), Delete - O(1), Print - O(1) | Easy | 25 |
Disjoint Set
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Spaceholder |
|
O(1) | O(1) | Easy | 1 |
Multiple Choice
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Data Structures MCQ 1 |
|
NA | NA | Hard | 5 | ||
| Data Structures MCQ 2 |
|
NA | NA | Hard | 5 | ||
| Data Structures MCQ 3 |
|
NA | NA | Hard | 5 |
Trie
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Contacts |
|
Add - O(L), Find - O(L) | Add - O(L), Find - O(1) | Medium | 40 | L = Length of a contact name |
Advanced
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Spaceholder |
|
O(1) | O(1) | Easy | 1 |
Fundamentals
| # | Title | Solution | Time | Space | Difficulty | Points | Note |
|---|---|---|---|---|---|---|---|
| Leonardo's Prime Factors |
|
O(1) | O(1) | Easy | 10 |
