This repository contains 198 solutions to Hackerrank practice problems with Python 3.
If it was helpful please press a star.
- Algorithms
- Warmup
- Solve Me First | Problem | Solution | Difficulty: Easy | Score: 1
- Simple Array Sum | Problem | Solution | Difficulty: Easy | Score: 10
- Compare the Triplets | Problem | Solution | Difficulty: Easy | Score: 10
- A Very Big Sum | Problem | Solution | Difficulty: Easy | Score: 10
- Diagonal Difference | Problem | Solution | Difficulty: Easy | Score: 10
- Plus Minus | Problem | Solution | Difficulty: Easy | Score: 10
- Staircase | Problem | Solution | Difficulty: Easy | Score: 10
- Mini-Max Sum | Problem | Solution | Difficulty: Easy | Score: 10
- Birthday Cake Candles | Problem | Solution | Difficulty: Easy | Score: 10
- Time Conversion | Problem | Solution | Difficulty: Easy | Score: 15
- Implementation
- Sock Merchant | Problem | Solution | Difficulty: Easy | Score: 10
- Counting Valleys | Problem | Solution | Difficulty: Easy | Score: 15
- Jumping on the Clouds | Problem | Solution | Difficulty: Easy | Score: 20
- Repeated String | Problem | Solution | Difficulty: Easy | Score: 20
- Count Triplets | Problem | Solution | Difficulty: Medium | Score: 35
- Frequency Queries | Problem | Solution | Difficulty: Medium | Score: 40
- Grading Students | Problem | Solution | Difficulty: Easy | Score: 10
- Apple and Orange | Problem | Solution | Difficulty: Easy | Score: 10
- Kangaroo | Problem | Solution | Difficulty: Easy | Score: 10
- Between Two Sets | Problem | Solution | Difficulty: Easy | Score: 10
- Breaking The Records | Problem | Solution | Difficulty: Easy | Score: 10
- Birthday Chocolate | Problem | Solution | Difficulty: Easy | Score: 10
- Divisible Sum Pairs | Problem | Solution | Difficulty: Easy | Score: 10
- Migratory Birds | Problem | Solution | Difficulty: Easy | Score: 10
- Day of the Programmer | Problem | Solution | Difficulty: Easy | Score: 15
- Bon Appetit | Problem | Solution | Difficulty: Easy | Score: 10
- Drawing Book | Problem | Solution | Difficulty: Easy | Score: 10
- Electronics Shop | Problem | Solution | Difficulty: Easy | Score: 15
- Cats and a Mouse | Problem | Solution | Difficulty: Easy | Score: 15
- Forming a Magic Square | Problem | Solution | Difficulty: Medium | Score: 20
- Picking Numbers | Problem | Solution | Difficulty: Easy | Score: 20
- Climbing the Leaderboard | Problem | Solution | Difficulty: Medium | Score: 20
- The Hurdle Race | Problem | Solution | Difficulty: Easy | Score: 15
- Designer PDF Viewer | Problem | Solution | Difficulty: Easy | Score: 20
- Utopian Tree | Problem | Solution | Difficulty: Easy | Score: 20
- Angry Professor | Problem | Solution | Difficulty: Easy | Score: 20
- Beautiful Days at the Movies | Problem | Solution | Difficulty: Easy | Score: 15
- Viral Advertising | Problem | Solution | Difficulty: Easy | Score: 15
- Save the Prisoner! | Problem | Solution | Difficulty: Easy | Score: 15
- Circular Array Rotation | Problem | Solution | Difficulty: Easy | Score: :20
- Sequence Equation | Problem | Solution | Difficulty: Easy | Score: 20
- Jumping on the Clouds; Revisited | Problem | Solution | Difficulty: Easy | Score: 15
- Find Digits | Problem | Solution | Difficulty: Easy | Score: 25
- Extra Long Factorials | Problem | Solution | Difficulty: Medium | Score: 20
- Append and Delete | Problem | Solution | Difficulty: Easy | Score: 20
- Sherlock and Squares | Problem | Solution | Difficulty: Easy | Score: 20
- Library Fine | Problem | Solution | Difficulty: Easy | Score: 15
- Cut the Sticks | Problem | Solution | Difficulty: Easy | Score: 25
- Non-divisible Subset | Problem | Solution | Difficulty: Medium | Score: 20
- Equalize the Array | Problem | Solution | Difficulty: Easy | Score: 20
- Queen's Attack II | Problem | Solution | Difficulty: Medium | Score: 30
- ACM ICPC Team | Problem | Solution | Difficulty: Easy | Score: 25
- Taum and B'day | Problem | Solution | Difficulty: Easy | Score: 25
- Organizing Containers of Balls | Problem | Solution | Difficulty: Medium | Score: 30
- Encryption | Problem | Solution | Difficulty: Medium | Score: 30
- Bigger is Greater | Problem | Solution | Difficulty: Medium | Score: 35
- Modified Kaprekar Numbers | Problem | Solution | Difficulty: Easy | Score: 30
- Beautiful Triplets | Problem | Solution | Difficulty: Easy | Score: 20
- Minimum Distances | Problem | Solution | Difficulty: Easy | Score: 20
- Halloween Sale | Problem | Solution | Difficulty: Easy | Score: 20
- The Time in Words | Problem | Solution | Difficulty: Medium | Score: 25
- Chocolate Feast | Problem | Solution | Difficulty: Easy | Score: 25
- Service Lane | Problem | Solution | Difficulty: Easy | Score: 20
- Lisa's Workbook | Problem | Solution | Difficulty: Easy | Score: 25
- Flatland Space Stations | Problem | Solution | Difficulty: Easy | Score: 25
- Fair Rations | Problem | Solution | Difficulty: Easy | Score: 25
- Cavity Map | Problem | Solution | Difficulty: Easy | Score: 30
- Manasa and Stones | Problem | Solution | Difficulty: Easy | Score: 30
- The Grid Search | Problem | Solution | Difficulty: Medium | Score: 30
- Happy Ladybugs | Problem | Solution | Difficulty: Easy | Score: 30
- Strange Counter | Problem | Solution | Difficulty: Easy | Score: 30
- 3D Surface Area | Problem | Solution | Difficulty: Medium | Score: 30
- Absolute Permutation | Problem | Solution | Difficulty: Medium | Score: 40
- The Bomberman Game | Problem | Solution | Difficulty: Medium | Score: 40
- Ema's Supercomputer | Problem | Solution | Difficulty: Medium | Score: 40
- arry's Array | Problem | Solution | Difficulty: Medium | Score: 40
- Almost Sorted | Problem | Solution | Difficulty: Medium | Score: 50
- Matrix Layer Rotation | Problem | Solution | Difficulty: Hard | Score: 80
- Strings
- Hash Tables; Ransom Note | Problem | Solution | Difficulty: Easy | Score: 25
- Two Strings | Problem | Solution | Difficulty: Easy | Score: 25
- Sherlock and Anagrams | Problem | Solution | Difficulty: Medium | Score: 50
- Making Anagrams | Problem | Solution | Difficulty: Easy | Score: 25
- Alternating Characters | Problem | Solution | Difficulty: Easy | Score: 20
- Sherlock and the Valid String | Problem | Solution | Difficulty: Medium | Score: 35
- Special String Again | Problem | Solution | Difficulty: Medium | Score: 40
- Common Child | Problem | Solution | Difficulty: Medium | Score: 60
- Super Reduced String | Problem | Solution | Difficulty: Easy | Score: 10
- CamelCase | Problem | Solution | Difficulty: Easy | Score: 15
- Strong Password | Problem | Solution | Difficulty: Easy | Score: 15
- Two Characters | Problem | Solution | Difficulty: Easy | Score: 20
- Caesar Cipher | Problem | Solution | Difficulty: Easy | Score: 15
- Mars Exploration | Problem | Solution | Difficulty: Easy | Score: 15
- HackerRank in a String! | Problem | Solution | Difficulty: Easy | Score: 20
- Pangrams | Problem | Solution | Difficulty: Easy | Score: 20
- Weighted Uniform Strings | Problem | Solution | Difficulty: Easy | Score: 20
- Separate the Numbers | Problem | Solution | Difficulty: Easy | Score: 20
- Funny String | Problem | Solution | Difficulty: Easy | Score: 25
- Gemstones | Problem | Solution | Difficulty: Easy | Score: 20
- Beautiful Binary String | Problem | Solution | Difficulty: Easy | Score: 20
- Making Anagrams | Problem | Solution | Difficulty: Easy | Score: 30
- The Love-Letter Mystery | Problem | Solution | Difficulty: Easy | Score: 20
- Palindrome Index | Problem | Solution | Difficulty: Easy | Score: 25
- Determining DNA Health | Problem | Solution | Difficulty: Hard | Score: 50
- Anagram | Problem | Solution | Difficulty: Easy | Score: 25
- Sorting
- Bubble Sort | Problem | Solution | Difficulty: Easy | Score: 30
- Comparator | Problem | Solution | Difficulty: Medium | Score: 35
- Fraudulent Activity Notifications | Problem | Solution | Difficulty: Medium | Score: 40
- Merge Sort; Counting Inversions | Problem | Solution | Difficulty: Hard | Score: 45
- Big Sorting | Problem | Solution | Difficulty: Easy | Score: 20
- Intro to Tutorial Challenges | Problem | Solution | Difficulty: Easy | Score: 30
- Insertion Sort - Part 1 | Problem | Solution | Difficulty: Easy | Score: 30
- Insertion Sort - Part 2 | Problem | Solution | Difficulty: Easy | Score: 30
- Correctness and the Loop Invariant | Problem | Solution | Difficulty: Easy | Score: 30
- Running Time of Algorithms | Problem | Solution | Difficulty: Easy | Score: 30
- Quicksort 1 - Partition | Problem | Solution | Difficulty: Easy | Score: 10
- Counting Sort 1 | Problem | Solution | Difficulty: Easy | Score: 30
- Counting Sort 2 | Problem | Solution | Difficulty: Easy | Score: 30
- The Full Counting Sort | Problem | Solution | Difficulty: Medium | Score: 40
- Closest Numbers | Problem | Solution | Difficulty: Easy | Score: 35
- Insertion Sort Advanced Analysis | Problem | Solution | Difficulty: Advanced | Score: 50
- Search
- Hash Tables; Ice Cream Parlor | Problem | Solution | Difficulty: Medium | Score: 35
- Pairs | Problem | Solution | Difficulty: Medium | Score: 50
- Triple Sum | Problem | Solution | Difficulty: Medium | Score: 40
- Minimum Time Required | Problem | Solution | Difficulty: Medium | Score: 35
- Maximum Subarray Sum | Problem | Solution | Difficulty: Hard | Score: 65
- Making Candies | Problem | Solution | Difficulty: Hard | Score: 45
- Greedy
- Mark and Toys | Problem | Solution | Difficulty: Easy | Score: 35
- Minimum Absolute Difference in an Array | Problem | Solution | Difficulty: Easy | Score: 15
- Luck Balance | Problem | Solution | Difficulty: Easy | Score: 20
- Greedy Florist | Problem | Solution | Difficulty: Medium | Score: 35
- Max Min | Problem | Solution | Difficulty: Medium | Score: 35
- Reverse Shuffle Merge | Problem | Solution | Difficulty: Advanced | Score: 50
- Constructive Algorithms
- Recursion
- Warmup
- Data Structures
- Arrays
- 2D Array - DS | Problem | Solution | Difficulty: Easy | Score: 15
- Left Rotation | Problem | Solution | Difficulty: Easy | Score: 20
- Minimum Swaps 2 | Problem | Solution | Difficulty: Medium | Score: 40
- Array Manipulation | Problem | Solution | Difficulty: Hard | Score: 60
- Arrays - DS | Problem | Solution | Difficulty: Easy | Score: 10
- Dynamic Array | Problem | Solution | Difficulty: Easy | Score: 15
- Sparse Arrays | Problem | Solution | Difficulty: Medium | Score: 25
- Linked Lists
- Print the Elements of a Linked List | Problem | Solution | Difficulty: Easy | Score: 5
- Insert a Node at the Tail of Linked List | Problem | Solution | Difficulty: Easy | Score: 5
- Insert a node at the head of a linked list | Problem | Solution | Difficulty: Easy | Score: 5
- Insert a node at a specific position in a linked list | Problem | Solution | Difficulty: Easy | Score: 5
- Delete a Node | Problem | Solution | Difficulty: Easy | Score: 5
- Print in Reverse | Problem | Solution | Difficulty: Easy | Score: 5
- Reverse a linked list | Problem | Solution | Difficulty: Easy | Score: 5
- Trees
- Arrays
- Tutorial
- 10 Days of Statistics
- Day 0; Mean, Median, and Mode | Problem | Solution | Difficulty: Easy | Score: 30
- Day 0; Weighted Mean | Problem | Solution | Difficulty: Easy | Score: 30
- Day 1; Quartiles | Problem | Solution | Difficulty: Easy | Score: 30
- Day 1; Interquartile Range | Problem | Solution | Difficulty: Easy | Score: 30
- Day 1; Standard Deviation | Problem | Solution | Difficulty: Easy | Score: 30
- Day 4; Binomial Distribution I | Problem | Solution | Difficulty: Easy | Score: 30
- Day 4; Binomial Distribution II | Problem | Solution | Difficulty: Easy | Score: 30
- Day 4; Geometric Distribution I | Problem | Solution | Difficulty: Easy | Score: 30
- Day 4; Geometric Distribution II | Problem | Solution | Difficulty: Easy | Score: 30
- Day 5; Poisson Distribution I | Problem | Solution | Difficulty: Easy | Score: 30
- Day 5; Poisson Distribution II | Problem | Solution | Difficulty: Easy | Score: 30
- Day 5; Normal Distribution I | Problem | Solution | Difficulty: Easy | Score: 30
- Day 5; Normal Distribution II | Problem | Solution | Difficulty: Easy | Score: 30
- Day 6; The Central Limit Theorem I | Problem | Solution | Difficulty: Easy | Score: 30
- Day 6; The Central Limit Theorem II | Problem | Solution | Difficulty: Easy | Score: 30
- Day 6; The Central Limit Theorem III | Problem | Solution | Difficulty: Easy | Score: 30
- Day 7; Pearson Correlation Coefficient I | Problem | Solution | Difficulty: Easy | Score: 30
- Day 7; Spearman's Rank Correlation Coefficient | Problem | Solution | Difficulty: Easy | Score: 30
- Day 8; Least Square Regression Line | Problem | Solution | Difficulty: Easy | Score: 30
- Day 9; Multiple Linear Regression | Problem | Solution | Difficulty: Medium | Score: 30
- 30 Days of Code
- Day 0; Hello, World | Problem | Solution | Difficulty: Easy | Score: 30
- Day 1; Data Types | Problem | Solution | Difficulty: Easy | Score: 30
- Day 2; Operators | Problem | Solution | Difficulty: Easy | Score: 30
- Day 3; Intro to Conditional Statements | Problem | Solution | Difficulty: Easy | Score: 30
- Day 4; Class vs Instance | Problem | Solution | Difficulty: Easy | Score: 30
- Day 5; Loops | Problem | Solution | Difficulty: Easy | Score: 30
- Day 6; Let's Review | Problem | Solution | Difficulty: Easy | Score: 30
- Day 7; Arrays | Problem | Solution | Difficulty: Easy | Score: 30
- Day 8; Dictionaries and Maps | Problem | Solution | Difficulty: Easy | Score: 30
- Day 9; Recursion 3 | Problem | Solution | Difficulty: Easy | Score: 30
- Day 10; Binary Numbers | Problem | Solution | Difficulty: Easy | Score: 30
- Day 11; 2D Arrays | Problem | Solution | Difficulty: Easy | Score: 30
- Day 12; Inheritance | Problem | Solution | Difficulty: Easy | Score: 30
- Day 13; Abastact Classes | Problem | Solution | Difficulty: Easy | Score: 30
- Day 14; Scope | Problem | Solution | Difficulty: Easy | Score: 30
- Day 15; Linked List | Problem | Solution | Difficulty: Easy | Score: 30
- Day 16; Exceptions - String to Integer | Problem | Solution | Difficulty: Easy | Score: 30
- Day 17; More Exceptions | Problem | Solution | Difficulty: Easy | Score: 30
- Day 18; Queue and Stacks | Problem | Solution | Difficulty: Easy | Score: 30
- Day 19; Interfaces | Problem | Solution | Difficulty: Easy | Score: 30
- Day 20; Sorting | Problem | Solution | Difficulty: Easy | Score: 30
- Day 22; Binary Search Trees | Problem | Solution | Difficulty: Easy | Score: 30
- Day 23; BST Level-Order Traversal | Problem | Solution | Difficulty: Easy | Score: 30
- Day 24; More Linked Lists | Problem | Solution | Difficulty: Easy | Score: 30
- Day 25; Running Time and Complexity | Problem | Solution | Difficulty: Easy | Score: 30
- Day 26; Nested Logic | Problem | Solution | Difficulty: Easy | Score: 30
- Day 27; Testing | Problem | Solution | Difficulty: Easy | Score: 30
- Day 28; RegEx, Patterns, and Intro to Databases | Problem | Solution | Difficulty: Easy | Score: 30
- Day 29; Bitwise AND | Problem | Solution | Difficulty: Easy | Score: 30
- 10 Days of Statistics