Skip to content

πŸ’» πŸ”Œ Solutions and Explanations to practice problems (Algorithms, Data Structures, Mathematic, Statistics) on HackerRank, implemented with Python.

License

Notifications You must be signed in to change notification settings

aibenStunner/HackerRank

Repository files navigation

(Highly Efficient:zap:) solutions to problems on HackerRank implemented with Python.

| hackerrank | algorithms| data structures | mathematics | c | c++ | java | python | ruby | linux shell | functional programming | artificial intelligence | sql | databases | regex | interview preparation kit |30 days of code| 10 days of statistics |10 days of javascript |

Algorithms

# Problem Solution Difficulty Max Score Sub domain
1 Solve Me First Solution Easy 1 Warmup
2 Simple Array Sum Solution Easy 10 Warmup
3 Compare the Triplets Solution Easy 10 Warmup
4 A Very Big Sum Solution Easy 10 Warmup
5 Diagonal Difference Solution Easy 10 Warmup
6 Plus Minus Solution Easy 10 Warmup
7 Staircase Solution Easy 10 Warmup
8 Mini-Max Sum Solution Easy 10 Warmup
9 Birthday Cake Candles Solution Easy 10 Warmup
10 Time Conversion Solution Easy 15 Warmup
11 Grading Students Solution Easy 10 Implementation
12 Apple and Orange Solution Easy 10 Implementation
13 Kangaroo Solution Easy 10 Implementation
14 Breaking the Records Solution Easy 10 Implementation
15 Forming a Magic Square Solution Medium 20 Implementation
16 Find Digits Solution Easy 25 Implementation
17 Extra Long Factorials Solution Medium 20 Implementation
18 Append and Delete Solution Easy 20 Implementation
19 Sherlock and Squares Solution Easy 20 Implementation
20 Matrix Layer Rotation Solution Hard 80 Implementation
21 Super Reduced String Solution Easy 10 Implementation
22 Sherlock and The Beast Solution Easy 30 Greedy
23 Max Min Solution Medium 35 Greedy
24 Goodland Electricity Solution Medium 40 Greedy
25 Lonely Integer Solution Easy 20 Bit Manipulation
26 The Coin Change Problem Solution Medium 60 Dynamic Programming
27 Equal Solution Medium 30 Dynamic Programming
28 Greedy Florist Solution Medium 35 Greedy
29 Sherlock and Cost Solution Medium 50 Dynamic Programming
30 Jim and the Orders Solution Easy 40 Greedy
31 Permuting Two Arrays Solution Easy 40 Greedy
32 Construct the Array Solution Medium 35 Dynamic Programming
33 Minimum Absolute Difference in an Array Solution Easy 15 Greedy
34 Marc's Cakewalk Solution Easy 15 Greedy
35 Grid Challenge Solution Easy 20 Greedy
36 Luck Balance Solution Easy 20 Greedy
37 Maximum Perimeter Triangle Solution Easy 20 Greedy
38 Candies Solution Medium 50 Greedy
39 Beautiful Pairs Solution Easy 30 Greedy
40 Sam and substrings Solution Medium 40 Dynamic Programming
41 Priyanka and Toys Solution Easy 30 Greedy
42 Fibonacci Modified Solution Medium 45 Dynamic Programming
43 Largest Permutation Solution Easy 30 Greedy
44 Mark and Toys Solution Easy 35 Greedy
45 Abbreviation Solution Medium 40 Dynamic Programming
46 Chief Hopper Solution Hard 65 Greedy
47 Between Two Sets Solution Easy 10 Implementation
48 Sub-array Division Solution Easy 10 Implementation
49 Divisible Sum Pairs Solution Easy 10 Implementation
50 Migratory Birds Solution Easy 10 Implementation
51 Day of the Programmer Solution Easy 15 Implementation
52 Bill Division Solution Easy 10 Implementation
53 Drawing Book Solution Easy 10 Implementation
54 Electronics Shop Solution Easy 15 Implementation
55 Cats and a Mouse Solution Easy 15 Implementation
56 Picking Numbers Solution Easy 20 Implementation
57 Climbing the Leaderboard Solution Medium 20 Implementation
58 The Hurdle Race Solution Easy 15 Implementation
59 Designer PDF Viewer Solution Easy 20 Implementation
60 Utopian Tree Solution Easy 20 Implementation
61 Angry Professor Solution Easy 20 Implementation
62 Beautiful Days at the Movies Solution Easy 15 Implementation
63 Viral Advertising Solution Easy 15 Implementation
64 Save the Prisoner! Solution Easy 15 Implementation
65 Circular Array Rotation Solution Easy 20 Implementation
66 Sequence Equation Solution Easy 20 Implementation
67 Jumping on the Clouds: Revisited Solution Easy 15 Implementation
68 Library Fine Solution Easy 15 Implementation
69 Cut the sticks Solution Easy 25 Implementation
70 Non-Divisible Subset Solution Medium 20 Implementation
71 Equalize the Array Solution Easy 20 Implementation
72 Queen's Attack II Solution Medium 30 Implementation
73 ACM ICPC Team Solution Easy 25 Implementation
74 Taum and B'day Solution Easy 25 Implementation

Data Structures

# Problem Solution Difficulty Max Score Sub domain
1 Array - DS Solution Easy 10 Arrays
2 2D Array - DS Solution Easy 15 Arrays
3 Dynamic Array Solution Easy 15 Arrays
4 Left Rotation Solution Easy 20 Arrays
5 Sparse Arrays Solution Medium 25 Arrays
6 Array Manipulation Solution Hard 60 Arrays
7 Delete duplicate-value nodes from a sorted linked list Solution Easy 5 Linked Lists
8 Cycle Detection Solution Medium 5 Linked Lists
9 Find Merge Point of Two Lists Solution Easy 5 Linked Lists
10 Inserting a Node Into a Sorted Doubly Linked List Solution Easy 5 Linked Lists
11 Reverse a doubly linked list Solution Easy 5 Linked Lists
12 QHEAP1 Solution Easy 25 Heap
13 Jesse and Cookies Solution Easy 25 Heap
14 Find the Running Median Solution Hard 50 Heap
15 Equal Stacks Solution Easy 25 Stacks
16 Minimum Average Waiting Time Solution Hard 80 Heap
17 Game of Two Stacks Solution Medium 30 Stacks
18 Balanced Brackets Solution Medium 25 Stacks
19 Largest Rectangle Solution Medium 50 Stacks
20 Simple Text Editor Solution Medium 65 Stacks
21 Poisonous Plants Solution Hard 70 Stacks
22 AND xor OR Solution Hard 70 Stacks
23 Waiter Solution Medium 75 Stacks
24 Maximum Element Solution Easy 20 Stacks
25 Insert a node at the head of a linked list Solution Easy 5 Linked Lists
26 Insert a node at a specific position in a linked list Solution Easy 5 Linked Lists
27 Delete a Node Solution Easy 5 Linked Lists
28 Print in Reverse Solution Easy 5 Linked Lists
29 Reverse a linked list Solution Easy 5 Linked Lists
30 Compare two linked lists Solution Easy 5 Linked Lists
31 Merge two sorted linked lists Solution Easy 5 Linked Lists
32 Get Node Value Solution Easy 5 Linked Lists
33 Insert a Node at the Tail of a Linked List Solution Easy 5 Linked Lists
34 Print the Elements of a Linked List Solution Easy 5 Linked Lists
35 Tree: Preorder Traversal Solution Easy 10 Trees
36 Tree: Postorder Traversal Solution Easy 10 Trees
37 Tree: Inorder Traversal Solution Easy 10 Trees
38 Tree: Height of a Binary Tree Solution Easy 10 Trees
39 Tree : Top View Solution Easy 20 Trees
40 Tree: Level Order Traversal Solution Easy 20 Trees
41 Binary Search Tree : Insertion Solution Easy 20 Trees
42 Tree: Huffman Decoding Solution Medium 20 Trees
43 Binary Search Tree : Lowest Common Ancestor Solution Easy 30 Trees

Tutorials

# Problem Solution Difficulty Max Score Sub domain
1 Day 0: Mean, Median, and Mode Solution Easy 30 10 Days of Statistics
2 Day 0: Weighted Mean Solution Easy 30 10 Days of Statistics
3 Day 1: Quartiles Solution Easy 30 10 Days of Statistics
4 Day 1: Interquartile Range Solution Easy 30 10 Days of Statistics
5 Day 1: Standard Deviation Solution Easy 30 10 Days of Statistics
6 Day 4: Binomial Distribution I Solution Easy 30 10 Days of Statistics
7 Day 4: Binomial Distribution II Solution Easy 30 10 Days of Statistics
8 Day 4: Geometric Distribution I Solution Easy 30 10 Days of Statistics
9 Day 4: Geometric Distribution II Solution Easy 30 10 Days of Statistics
10 Day 5: Poisson Distribution I Solution Easy 30 10 Days of Statistics
11 Day 5: Poisson Distribution II Solution Easy 30 10 Days of Statistics
12 Day 5: Normal Distribution I Solution Easy 30 10 Days of Statistics
13 Day 5: Normal Distribution II Solution Easy 30 10 Days of Statistics
14 Day 6: The Central Limit Theorem I Solution Easy 30 10 Days of Statistics
15 Day 6: The Central Limit Theorem II Solution Easy 30 10 Days of Statistics
16 Day 6: The Central Limit Theorem III Solution Easy 30 10 Days of Statistics
17 Day 7: Pearson Correlation Coefficient I Solution Easy 30 10 Days of Statistics
18 Day 0: Hello, World! Solution Easy 10 10 Days of Javascript
19 Day 0: Data Types Solution Easy 10 10 Days of Javascript
29 Day 1: Arithmetic Operators Solution Easy 10 10 Days of Javascript
30 Day 1: Functions Solution Easy 10 10 Days of Javascript
31 Day 1: Let and Const Solution Easy 10 10 Days of Javascript
32 Day 2: Loops Solution Easy 10 10 Days of Javascript
33 Day 2: Conditional Statements: If-Else Solution Easy 10 10 Days of Javascript
34 Day 2: Conditional Statements: Switch Solution Easy 10 10 Days of Javascript
35 Day 3: Arrays Solution Easy 15 10 Days of Javascript
36 Day 3: Try, Catch, and Finally Solution Easy 15 10 Days of Javascript
37 Day 3: Throw Solution Easy 15 10 Days of Javascript
38 Day 4: Create a Rectangle Object Solution Easy 15 10 Days of Javascript
39 Day 4: Count Objects Solution Easy 15 10 Days of Javascript
40 Day 4: Classes Solution Easy 15 10 Days of Javascript
41 Day 5: Inheritance Solution Easy 15 10 Days of Javascript
42 Day 5: Template Literals Solution Easy 15 10 Days of Javascript
43 Day 5: Arrow Functions Solution Easy 15 10 Days of Javascript
44 Day 6: Bitwise Operators Solution Easy 15 10 Days of Javascript
45 Day 6: JavaScript Dates Solution Easy 15 10 Days of Javascript
46 Day 7: Regular Expressions I Solution Easy 15 10 Days of Javascript
47 Day 7: Regular Expressions II Solution Easy 15 10 Days of Javascript
48 Day 7: Regular Expressions III Solution Easy 15 10 Days of Javascript
49 Day 7: Spearman's Rank Correlation Coefficient Solution Easy 30 10 Days of Statistics
50 Day 8: Least Square Regression Line Solution Easy 30 10 Days of Statistics
51 Day 9: Multiple Linear Regression Solution Medium 30 10 Days of Statistics

Mathematics

# Problem Solution Difficulty Max Score Sub domain
1 Find the Point Solution Easy 5 Fundamentals
2 Maximum Draws Solution Easy 5 Fundamentals
3 Handshake Solution Easy 10 Fundamentals
4 Minimum Height Triangle Solution Easy 10 Fundamentals

SQL

# Problem Solution Difficulty Max Score Sub domain
1 Revising the Select Query I Solution Easy 10 Basic Select
2 Revising the Select Query II Solution Easy 10 Basic Select
3 Select All Solution Easy 10 Basic Select
4 Select By ID Solution Easy 10 Basic Select
5 Japanese Cities' Attributes Solution Easy 10 Basic Select
6 Japanese Cities' Names Solution Easy 10 Basic Select
7 Weather Observation Station 1 Solution Easy 15 Basic Select
8 Weather Observation Station 3 Solution Easy 10 Basic Select
9 Weather Observation Station 4 Solution Easy 10 Basic Select
10 Weather Observation Station 5 Solution Easy 30 Basic Select
11 Weather Observation Station 6 Solution Easy 10 Basic Select
12 Weather Observation Station 7 Solution Easy 10 Basic Select
13 Weather Observation Station 8 Solution Easy 15 Basic Select
14 Weather Observation Station 9 Solution Easy 10 Basic Select
15 Weather Observation Station 10 Solution Easy 10 Basic Select
16 Weather Observation Station 11 Solution Easy 15 Basic Select
17 Weather Observation Station 12 Solution Easy 15 Basic Select
18 Higher Than 75 Marks Solution Easy 15 Basic Select
19 Employee Names Solution Easy 10 Basic Select
20 Employee Salaries Solution Easy 10 Basic Select
21 Type of Triangle Solution Easy 20 Advanced Select
22 The PADS Solution Medium 30 Advanced Select
23 Binary Tree Nodes Solution Medium 30 Advanced Select
24 New Companies Solution Medium 30 Advanced Select
25 Revising Aggregations - The Count Function Solution Easy 10 Aggregation
26 Revising Aggregations - The Sum Function Solution Easy 10 Aggregation
27 Revising Aggregations - Averages Solution Easy 10 Aggregation
28 Average Population Solution Easy 10 Aggregation
29 Japan Population Solution Easy 10 Aggregation
30 Population Density Difference Solution Easy 10 Aggregation
31 The Blunder Solution Easy 15 Aggregation
32 Top Earners Solution Easy 20 Aggregation
33 Weather Observation Station 2 Solution Easy 15 Aggregation
34 Weather Observation Station 13 Solution Easy 10 Aggregation
35 Weather Observation Station 14 Solution Easy 10 Aggregation
36 Weather Observation Station 15 Solution Easy 15 Aggregation
37 Weather Observation Station 16 Solution Easy 10 Aggregation
38 Weather Observation Station 17 Solution Easy 15 Aggregation
39 Weather Observation Station 18 Solution Medium 25 Aggregation
40 Weather Observation Station 19 Solution Medium 30 Aggregation
41 Weather Observation Station 20 Solution Medium 40 Aggregation
42 Asian Population Solution Easy 10 Basic Join
43 African Cities Solution Easy 10 Basic Join
44 Average Population of Each Continent Solution Easy 10 Basic Join
45 The Report Solution Medium 20 Basic Join
46 Top Competitors Solution Medium 30 Basic Join
47 Draw The Triangle 1 Solution Easy 25 Alternative Queries
48 Draw The Triangle 2 Solution Easy 25 Alternative Queries
49 Ollivander's Inventory Solution Medium 30 Basic Join
50 Challenges Solution Medium 30 Basic Join
51 Contest Leaderboard Solution Medium 30 Basic Join
52 Symmetric Pairs Solution Medium 40 Advanced Join
53 Interviews Solution Hard 50 Advanced Join
54 15 Days of Learning SQL Solution Hard 50 Advanced Join
55 Print Prime Numbers Solution Medium 40 Alternative Queries
56 SQL Project Planning Solution Medium 40 Advanced Join
57 Placements Solution Medium 40 Advanced Join

Interview Preparation Kit

# Problem Solution Difficulty Max Score Sub domain
1 Sock Merchant Solution Easy 10 Warm-up Challenges
2 Counting Valleys Solution Easy 15 Warm-up Challenges
3 Jumping on the Clouds Solution Easy 20 Warm-up Challenges
4 Repeated String Solution Easy 20 Warm-up Challenges
5 2D Array - DS Solution Easy 15 Arrays
6 Array Manipulation Solution Hard 60 Arrays
7 Arrays: Left Rotation Solution Easy 20 Arrays
8 New Year Chaos Solution Medium 40 Arrays
9 Minimum Swaps 2 Solution Medium 40 Arrays
10 Hash Tables: Ransom Note Solution Easy 25 Dictionaries and Hashmaps
11 Hash Tables: Ransom Note Solution Easy 25 Dictionaries and Hashmaps
12 Sherlock and Anagrams Solution Medium 50 Dictionaries and Hashmaps
13 Count Triplets Solution Medium 35 Dictionaries and Hashmaps
14 Frequency Queries Solution Medium 40 Dictionaries and Hashmaps
15 Mark and Toys Solution Easy 35 Sorting
16 Sorting: Bubble Sort Solution Easy 30 Sorting
17 Sorting: Comparator Solution Medium 35 Sorting
18 Fraudulent Activity Notifications Solution Medium 40 Sorting
19 Merge Sort: Counting Inversions Solution Hard 45 Sorting
20 Strings: Making Anagrams Solution Easy 25 String Manipulation
21 Alternating Characters Solution Easy 20 String Manipulation
22 Sherlock and the Valid String Solution Medium 35 String Manipulation
23 Special String Again Solution Medium 40 String Manipulation
24 Common Child Solution Medium 60 String Manipulation
25 Minimum Absolute Difference in an Array Solution Easy 15 Greedy Algorithms
26 Luck Balance Solution Easy 20 Greedy Algorithms
27 Greedy Florist Solution Medium 35 Greedy Algorithms
28 Max Min Solution Medium 35 Greedy Algorithms
29 Hash Tables: Ice Cream Parlor Solution Medium 35 Search
30 Pairs Solution Medium 50 Search
31 Triple sum Solution Medium 40 Search
32 Minimum Time Required Solution Medium 35 Search
33 Maximum Subarray Sum Solution Hard 65 Search
34 Recursion: Fibonacci Numbers Solution Easy 15 Recursion and Backtracking
35 Recursion: Davis' Staircase Solution Medium 30 Recursion and Backtracking

C++

# Problem Solution Difficulty Max Score Sub domain
1 Say "Hello, World!" With C++ Solution Easy 5 Introduction
2 Input and Output Solution Easy 5 Introduction
3 Basic Data Types Solution Easy 10 Introduction
4 Conditional Statements Solution Easy 10 Introduction
5 For Loop Solution Easy 10 Introduction
6 Functions Solution Easy 10 Introduction
7 Pointer Solution Easy 10 Introduction
8 Array Introduction Solution Easy 10 Introduction
9 Variable Sized Arrays Solution Easy 30 Introduction
10 Hotel Prices Solution Medium 15 Debugging
11 Cpp exception handling Solution Medium 20 Debugging
12 Overloading Ostream Operator Solution Medium 20 Debugging
13 Messages Order Solution Medium 40 Debugging
14 StringStream Solution Easy 10 Strings
15 Strings Solution Easy 10 Strings
16 Structs Solution Easy 10 Classes
17 Class Solution Easy 10 Classes
18 Classes and Objects Solution Easy 20 Classes

Artificial Intelligence

# Problem Solution Difficulty Max Score Sub domain
1 Bot saves princess Solution Easy 13.90 Bot Building
2 Bot saves princess - 2 Solution Easy 17.50 Bot Building
3 Bot Clean Solution Easy 17.82 Bot Building
4 Bot Clean Stochastic Solution Easy 10.00 Bot Building
5 BotClean Large Solution Hard 54.00 Bot Building
6 BotClean Partially Observable Solution Hard 28.00 Bot Building
7 PacMan - DFS Solution Easy 15.00 A* Search

Contributing

If you are interested in helping or have a solution in a different language feel free to make a pull request. You can also reach me on through the following media if you want to talk.

About

πŸ’» πŸ”Œ Solutions and Explanations to practice problems (Algorithms, Data Structures, Mathematic, Statistics) on HackerRank, implemented with Python.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published