/HackerRank_solutions

317 efficient solutions to HackerRank problems

Primary LanguageJavaMIT LicenseMIT


317 efficient solutions to HackerRank problems

Solutions are coded using Java 8

SQL solutions are coded using MySQL

10 Days of Statistics

Day Challenge Points Solution
0 Mean, Median, and Mode 30 Solution.java
0 Weighted Mean 30 Solution.java
1 Quartiles 30 Solution.java
1 Interquartile Range 30 Solution.java
1 Standard Deviation 30 Solution.java
2 Basic Probability 10 Solution
2 More Dice 10 Solution
2 Compound Event Probability 10 Solution
3 Conditional Probability 10 Solution
3 Cards of the Same Suit 10 Solution
3 Drawing Marbles 10 Solution
4 Binomial Distribution I 30 Solution.java
4 Binomial Distribution II 30 Solution.java
4 Geometric Distribution I 30 Solution.java
4 Geometric Distribution II 30 Solution.java
5 Poisson Distribution I 30 Solution.java
5 Poisson Distribution II 30 Solution.java
5 Normal Distribution I 30 Solution.java
5 Normal Distribution II 30 Solution.java
6 The Central Limit Theorem I 30 Solution.java
6 The Central Limit Theorem II 30 Solution.java
6 The Central Limit Theorem III 30 Solution.java
7 Pearson Correlation Coefficient I 30 Solution.java
7 Spearman's Rank Correlation Coefficient 30 Solution.java
8 Least Square Regression Line 30 Solution.java
8 Pearson Correlation Coefficient II 30 Solution
9 Multiple Linear Regression 30 Solution.java

30 Days of Code

Day Challenge Points Solution
0 Hello, World 30 Solution.java
1 Data Types 30 Solution.java
2 Operators 30 Solution.java
3 Intro to Conditional Statements 30 Solution.java
4 Class vs. Instance 30 Solution.java
5 Loops 30 Solution.java
6 Let's Review 30 Solution.java
7 Arrays 30 Solution.java
8 Dictionaries and Maps 30 Solution.java
9 Recursion 30 Solution.java
10 Binary Numbers 30 Solution.java
11 2D Arrays 30 Solution.java
12 Inheritance 30 Solution.java
13 Abstract Classes 30 Solution.java
14 Scope 30 Solution.java
15 Linked List 30 Solution.java
16 Exceptions - String to Integer 30 Solution.java
17 More Exceptions 30 Solution.java
18 Queues and Stacks 30 Solution.java
19 Interfaces 30 Solution.java
20 Sorting 30 Solution.java
21 Generics 30 Solution.java
22 Binary Search Trees 30 Solution.java
23 BST Level-Order Traversal 30 Solution.java
24 More Linked Lists 30 Solution.java
25 Running Time and Complexity 30 Solution.java
26 Nested Logic 30 Solution.java
27 Testing 30 Solution.java

Algorithms

Subdomain Challenge Points Solution
Sorting Quicksort 1 - Partition 10 Solution.java
Sorting Marc's Cakewalk 15 Solution.java
Sorting Minimum Absolute Difference in an Array 15 Solution.java
Sorting Luck Balance 20 Solution.java
Sorting Insertion Sort - Part 1 30 Solution.java
Sorting Insertion Sort - Part 2 30 Solution.java
Sorting Correctness and the Loop Invariant 30 Solution.java
Sorting Running Time of Algorithms 30 Solution.java
Sorting Quicksort 2 - Sorting 30 Solution.java
Sorting Counting Sort 1 30 Solution.java
Sorting Counting Sort 2 30 Solution.java
Sorting Counting Sort 3 30 Solution.java
Sorting Intro to Tutorial Challenges 30 Solution.java
Sorting Quicksort In-Place 35 Solution.java
Sorting Running Time of Quicksort 35 Solution.java
Sorting The Full Counting Sort 40 Solution.java
Search Ice Cream Parlor 30 Solution.java
Search Connected Cells in a Grid 50 Solution.java
Greedy Grid Challenge 20 Solution.java
Greedy Maximum Perimeter Triangle 20 Solution.java
Greedy Beautiful Pairs 30 Solution.java
Graph Theory Breadth First Search - Shortest Reach 55 Solution.java
Strings Super Reduced String 10 Solution.java
Strings CamelCase 15 Solution.java
Strings Two Characters 15 Solution.java
Strings Caesar Cipher 15 Solution.java
Strings Mars Exploration 15 Solution.java
Strings Weighted Uniform Strings 20 Solution.java
Strings Gemstones 20 Solution.java
Strings Alternating Characters 20 Solution.java
Strings Beautiful Binary String 20 Solution.java
Strings The Love-Letter Mystery 20 Solution.java
Strings String Construction 25 Solution.java
Dynamic Programming The Coin Change Problem 60 Solution.java
Bit Manipulation Lonely Integer 20 Solution.java
Bit Manipulation Bit Manipulation: Lonely Integer 20 Solution.java
Bit Manipulation Sum vs XOR 25 Solution.java
Bit Manipulation Maximizing XOR 30 Solution.java
Bit Manipulation Sansa and XOR 30 Solution.java
Bit Manipulation Counter game 30 Solution.java

Cracking the Coding Interview

Topic Challenge Points Solution
Techniques / Concepts Time Complexity: Primality 15 Solution.java
Techniques / Concepts Recursion: Fibonacci Numbers 20 Solution.java
Techniques / Concepts Recursion: Davis' Staircase 30 Solution.java
Techniques / Concepts DP: Coin Change 30 Solution.java
Techniques / Concepts Bit Manipulation: Lonely Integer 60 Solution.java
Data Structures Arrays: Left Rotation 20 Solution.java
Data Structures Strings: Making Anagrams 25 Solution.java
Data Structures Hash Tables: Ransom Note 25 Solution.java
Data Structures Linked Lists: Detect a Cycle 25 Solution.java
Data Structures Stacks: Balanced Brackets 30 Solution.java
Data Structures Queues: A Tale of Two Stacks 30 Solution.java
Data Structures Trees: Is This a Binary Search Tree? 30 Solution.java
Data Structures Heaps: Find the Running Median 50 Solution.java
Data Structures Tries: Contacts 50 Solution.java
Algorithms Sorting: Bubble Sort 30 Solution.java
Algorithms Sorting: Comparator 35 Solution.java
Algorithms Merge Sort: Counting Inversions 35 Solution.java
Algorithms Binary Search: Ice Cream Parlor 45 Solution.java
Algorithms DFS: Connected Cell in a Grid 45 Solution.java
Algorithms BFS: Shortest Reach in a Graph 45 Solution.java

Data Structures

Subdomain Challenge Points Solution
Arrays Arrays - DS 10 Solution.java
Arrays 2D Array - DS 15 Solution.java
Arrays Dynamic Array 15 Solution.java
Arrays Left Rotation 20 Solution.java
Arrays Sparse Arrays 25 Solution.java
Arrays Algorithmic Crush 60 Solution.java
Stacks Maximum Element 20 Solution.java
Stacks Balanced Brackets 25 Solution.java
Trees Tree: Preorder Traversal 10 Solution.java
Trees Tree: Inorder Traversal 10 Solution.java
Trees Tree: Postorder Traversal 10 Solution.java
Trees Tree: Height of a Binary Tree 10 Solution.java
Trees Tree: Level Order Traversal 20 Solution.java
Trees Tree: Huffman Decoding 20 Solution.java
Trees Binary Search Tree: Insertion 20 Solution.java
Trees Binary Search Tree: Lowest Common Ancestor 30 Solution.java
Trees Is This a Binary Search Tree? 30 Solution.java
Trees Swap Nodes [Algo] 40 Solution.java
Trees Square-Ten Tree 60 Solution.java
Linked List Print the Elements of a Linked List 5 Solution.java
Linked List Insert a node at the head of a linked list 5 Solution.java
Linked List Insert a Node at the Tail of a Linked List 5 Solution.java
Linked List Insert a node at a specific position in a linked list 5 Solution.java
Linked List Delete a Node 5 Solution.java
Linked List Print in Reverse 5 Solution.java
Linked List Reverse a linked list 5 Solution.java
Linked List Compare two linked lists 5 Solution.java
Linked List Merge two sorted linked lists 5 Solution.java
Linked List Get Node Value 5 Solution.java
Linked List Delete duplicate-value nodes from a sorted linked list 5 Solution.java
Linked List Cycle Detection 5 Solution.java
Linked List Find Merge Point of Two Lists 5 Solution.java
Linked List Inserting a Node Into a Sorted Doubly Linked List 5 Solution.java
Linked List Reverse a doubly linked list 5 Solution.java
Tries Contacts 40 Solution.java
Queues Queue using Two Stacks 30 Solution.java
Heaps Find the Running Median 50 Solution.java
Multiple Choice Data Structures MCQ 1 5 Solution
Multiple Choice Data Structures MCQ 2 5 Solution
Multiple Choice Data Structures MCQ 3 5 Solution

General Programming

Subdomain Challenge Points Solution
Basic Programming Solve Me First 1 Solution.java
Basic Programming Staircase 10 Solution.java
Basic Programming Plus Minus 10 Solution.java
Basic Programming Diagonal Difference 10 Solution.java
Basic Programming A Very Big Sum 10 Solution.java
Basic Programming Simple Array Sum 10 Solution.java
Basic Programming Compare the Triplets 10 Solution.java
Basic Programming Divisible Sum Pairs 10 Solution.java
Basic Programming Kangaroo 10 Solution.java
Basic Programming Drawing Book 10 Solution.java
Basic Programming Birthday Cake Candles 10 Solution.java
Basic Programming Bon Appetit 10 Solution.java
Basic Programming Sock Merchant 10 Solution.java
Basic Programming Apple and Orange 10 Solution.java
Basic Programming Between Two Sets 10 Solution.java
Basic Programming Mini-max Sum 10 Solution.java
Basic Programming Grading Students 10 Solution.java
Basic Programming Breaking the Records 10 Solution.java
Basic Programming Migratory Birds 10 Solution.java
Basic Programming Birthday Chocolate 10 Solution.java
Basic Programming Time Conversion 15 Solution.java
Basic Programming Library Fine 15 Solution.java
Basic Programming Save the Prisoner! 15 Solution.java
Basic Programming Jumping on the Clouds - Revisited 15 Solution.java
Basic Programming Counting Valleys 15 Solution.java
Basic Programming Viral Advertising 15 Solution.java
Basic Programming Beautiful Days at the Movies 15 Solution.java
Basic Programming Electronics Shop 15 Solution.java
Basic Programming Cats and a Mouse 15 Solution.java
Basic Programming The Hurdle Race 15 Solution.java
Basic Programming Utopian Tree 20 Solution.java
Basic Programming Circular Array Rotation 20 Solution.java
Basic Programming Sherlock and Squares 20 Solution.java
Basic Programming Angry Professor 20 Solution.java
Basic Programming Extra Long Factorials 20 Solution.java
Basic Programming Minimum Distances 20 Solution.java
Basic Programming Jumping on the Clouds 20 Solution.java
Basic Programming Equalize the Array 20 Solution.java
Basic Programming Designer PDF Viewer 20 Solution.java
Basic Programming Repeated String 20 Solution.java
Basic Programming Append and Delete 20 Solution.java
Basic Programming Picking Numbers 20 Solution.java
Basic Programming Climbing the Leaderboard 20 Solution.java
Basic Programming Sequence Equation 20 Solution.java
Basic Programming Find Digits 25 Solution.java
Basic Programming Cut the sticks 25 Solution.java
Basic Programming Taum and B'day 25 Solution.java
Basic Programming Flatland Space Stations 25 Solution.java
Basic Programming Fair Rations 25 Solution.java
Basic Programming Manasa and Stones 30 Solution.java
Object-Oriented Programming Class vs. Instance 30 Solution.java
Object-Oriented Programming Inheritance 30 Solution.java
Object-Oriented Programming Abstract Classes 30 Solution.java
RegEx HackerRank in a String! 20 Solution.java

Implementation

Subdomain Challenge Points Solution
Brute Force Pangrams 20 Solution.java
Brute Force Strings: Making Anagrams 25 Solution.java
Brute Force Making Anagrams 30 Solution.java
Brute Force Modified Kaprekar Numbers 30 Solution.java

Java

Subdomain Challenge Points Solution
Introduction Welcome to Java! 3 Solution.java
Introduction Java Stdin and Stdout I 5 Solution.java
Introduction Java If-Else 10 Solution.java
Introduction Java Stdin and Stdout II 10 Solution.java
Introduction Java Output Formatting 10 Solution.java
Introduction Java Loops I 10 Solution.java
Introduction Java Loops II 10 Solution.java
Introduction Java Datatypes 10 Solution.java
Introduction Java End-of-file 10 Solution.java
Introduction Java Static Initializer Block 10 Solution.java
Introduction Java Int to String 10 Solution.java
Introduction Java Date and Time 15 Solution.java
Introduction Java Currency Formatter 15 Solution.java
Strings Java Strings Introduction 5 Solution.java
Strings Java Substring 5 Solution.java
Strings Java String Compare 10 Solution.java
Strings Java String Reverse 10 Solution.java
Strings Java Anagrams 10 Solution.java
Strings Java String Tokens 15 Solution.java
Strings Pattern Syntax Checker 20 Solution.java
Strings Java Regex 25 Solution.java
Strings Java Regex 2 - Duplicate Words 25 Solution.java
Strings Java Regex 3 - Username Checker 20 Solution.java
Strings Tag Content Extractor 20 Solution.java
BigNumber Java BigInteger 10 Solution.java
BigNumber Java BigDecimal 20 Solution.java
BigNumber Java Primality Test 20 Solution.java
Data Structures Java 1D Array 5 Solution.java
Data Structures Java 2D Array 10 Solution.java
Data Structures Java Subarray 10 Solution.java
Data Structures Java Arraylist 10 Solution.java
Data Structures Java 1D Array (Part 2) 25 Solution.java
Data Structures Java List 15 Solution.java
Data Structures Java Map 10 Solution.java
Data Structures Java Stack 20 Solution.java
Data Structures Java Hashset 10 Solution.java
Data Structures Java Generics 15 Solution.java
Data Structures Java Comparator 10 Solution.java
Data Structures Java Sort 10 Solution.java
Data Structures Java Dequeue 20 Solution.java
Data Structures Java BitSet 20 Solution.java
Object Oriented Programming Java Inheritance I 5 Solution.java
Object Oriented Programming Java Inheritance II 10 Solution.java
Object Oriented Programming Java Abstract Class 10 Solution.java
Object Oriented Programming Java Interface 10 Solution.java
Object Oriented Programming Java Method Overriding 10 Solution.java
Object Oriented Programming Java Method Overriding 2 (Super Keyword) 10 Solution.java
Object Oriented Programming Java Instanceof keyword 10 Solution.java
Object Oriented Programming Java Iterator 15 Solution.java
Object Oriented Programming Calculating Volume 20 Solution.java
Exception Handling Java Exception Handling (Try-catch) 10 Solution.java
Exception Handling Java Exception Handling 15 Solution.java
Advanced Java Varargs - Simple Addition 15 Solution.java
Advanced Java Reflection - Attributes 15 Solution.java
Advanced Can You Access 15 Solution.java
Advanced Prime Checker 25 Solution.java
Advanced Java Factory Pattern 15 Solution.java
Advanced Java Singleton Pattern 15 Solution.java
Advanced Java Visitor Pattern 40 Solution.java
Advanced Java Annotations 25 Solution.java
Advanced Covariant Return Types 20 Solution.java
Advanced Java Lambda Expressions 30 Solution.java
Advanced Java MD5 30 Solution.java
Advanced Java SHA-256 30 Solution.java

SQL

Subdomain Challenge Points Solution
Basic Select Revising the Select Query I 10 MySQL Solution
Basic Select Revising the Select Query II 10 MySQL Solution
Basic Select Select All 10 MySQL Solution
Basic Select Select By ID 10 MySQL Solution
Basic Select Japanese Cities' Attributes 10 MySQL Solution
Basic Select Japanese Cities' Names 10 MySQL Solution
Basic Select Weather Observation Station 1 15 MySQL Solution
Basic Select Weather Observation Station 3 10 MySQL Solution
Basic Select Weather Observation Station 4 10 MySQL Solution
Basic Select Weather Observation Station 5 30 MySQL Solution
Basic Select Weather Observation Station 6 10 MySQL Solution
Basic Select Weather Observation Station 7 10 MySQL Solution
Basic Select Weather Observation Station 8 15 MySQL Solution
Basic Select Weather Observation Station 9 10 MySQL Solution
Basic Select Weather Observation Station 10 10 MySQL Solution
Basic Select Weather Observation Station 11 15 MySQL Solution
Basic Select Weather Observation Station 12 15 MySQL Solution
Basic Select Higher Than 75 Marks 15 MySQL Solution
Basic Select Employee Names 10 MySQL Solution
Basic Select Employee Salaries 10 MySQL Solution
Basic Join Asian Population 10 MySQL Solution
Basic Join African Cities 10 MySQL Solution
Basic Join Average Population of Each Continent 10 MySQL Solution
Basic Join The Report 20 MySQL Solution
Aggregation Revising Aggregations - The Count Function 10 MySQL Solution
Aggregation Revising Aggregations - The Sum Function 10 MySQL Solution
Aggregation Revising Aggregations - Averages 10 MySQL Solution
Aggregation Average Population 10 MySQL Solution
Aggregation Japan Population 10 MySQL Solution
Aggregation Population Density Difference 10 MySQL Solution
Aggregation The Blunder 15 MySQL Solution
Aggregation Top Earners 20 MySQL Solution
Aggregation Weather Observation Station 2 15 MySQL Solution
Aggregation Weather Observation Station 13 10 MySQL Solution
Aggregation Weather Observation Station 14 10 MySQL Solution
Aggregation Weather Observation Station 15 15 MySQL Solution
Aggregation Weather Observation Station 16 10 MySQL Solution
Aggregation Weather Observation Station 17 15 MySQL Solution
Aggregation Weather Observation Station 18 25 MySQL Solution
Aggregation Weather Observation Station 19 30 MySQL Solution