/HackerRank-solutions

301 efficient solutions to HackerRank problems

Primary LanguageJavaMIT LicenseMIT


301 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 Difficulty Solution
Warmup Solve Me First Easy Solution.java
Warmup Simple Array Sum Easy Solution.java
Warmup Compare the Triplets Easy Solution.java
Warmup A Very Big Sum Easy Solution.java
Warmup Diagonal Difference Easy Solution.java
Warmup Plus Minus Easy Solution.java
Warmup Staircase Easy Solution.java
Warmup Mini-max Sum Easy Solution.java
Warmup Time Conversion Easy Solution.java
Implementation Grading Students Easy Solution.java
Implementation Designer PDF Viewer Easy Solution.java
Implementation Apple and Orange Easy Solution.java
Implementation Kangaroo Easy Solution.java
Implementation Between Two Sets Easy Solution.java
Implementation Divisible Sum Pairs Easy Solution.java
Implementation Bon Appetit Easy Solution.java
Implementation Sock Merchant Easy Solution.java
Implementation The Hurdle Race Easy Solution.java
Implementation Utopian Tree Easy Solution.java
Implementation Angry Professor Easy Solution.java
Implementation Beautiful Days at the Movies Easy Solution.java
Implementation Viral Advertising Easy Solution.java
Implementation Save the Prisoner! Easy Solution.java
Implementation Sequence Equation Easy Solution.java
Implementation Circular Array Rotation Easy Solution.java
Implementation Jumping on the Clouds - Revisited Easy Solution.java
Implementation Find Digits Easy Solution.java
Implementation Extra Long Factorials Medium Solution.java
Implementation Append and Delete Easy Solution.java
Implementation Sherlock and Squares Easy Solution.java
Implementation Library Fine Easy Solution.java
Implementation Cut the sticks Easy Solution.java
Implementation Repeated String Easy Solution.java
Implementation Jumping on the Clouds Easy Solution.java
Implementation Equalize the Array Easy Solution.java
Implementation Taum and B'day Easy Solution.java
Implementation Modified Kaprekar Numbers Easy Solution.java
Implementation Beautiful Triplets Easy Solution.java
Implementation Manasa and Stones Easy Solution.java
Strings Super Reduced String Easy Solution.java
Strings CamelCase Easy Solution.java
Strings Two Characters Easy Solution.java
Strings Caesar Cipher Easy Solution.java
Strings Mars Exploration Easy Solution.java
Strings HackerRank in a String! Easy Solution.java
Strings Pangrams Easy Solution.java
Strings Weighted Uniform Strings Easy Solution.java
Strings Gemstones Easy Solution.java
Strings Alternating Characters Easy Solution.java
Strings The Love-Letter Mystery Easy Solution.java
Strings Making Anagrams Easy Solution.java
Sorting Intro to Tutorial Challenges Easy Solution.java
Sorting Insertion Sort - Part 1 Easy Solution.java
Sorting Insertion Sort - Part 2 Easy Solution.java
Sorting Correctness and the Loop Invariant Easy Solution.java
Sorting Running Time of Algorithms Easy Solution.java
Sorting Quicksort 1 - Partition Easy Solution.java
Sorting Quicksort 2 - Sorting Easy Solution.java
Sorting Quicksort In-Place Medium Solution.java
Sorting Running Time of Quicksort Easy Solution.java
Sorting Counting Sort 1 Easy Solution.java
Sorting Counting Sort 2 Easy Solution.java
Sorting Counting Sort 3 Easy Solution.java
Sorting The Full Counting Sort Medium Solution.java
Search Ice Cream Parlor Easy Solution.java
Search Connected Cells in a Grid Medium Solution.java
Graph Theory Breadth First Search - Shortest Reach Medium Solution.java
Greedy Minimum Absolute Difference in an Array Easy Solution.java
Greedy Marc's Cakewalk Easy Solution.java
Greedy Grid Challenge Easy Solution.java
Greedy Luck Balance Easy Solution.java
Greedy Maximum Perimeter Triangle Easy Solution.java
Greedy Beautiful Pairs Easy Solution.java
Dynamic Programming The Coin Change Problem Hard Solution.java
Bit Manipulation Lonely Integer Easy Solution.java
Bit Manipulation Bit Manipulation: Lonely Integer Easy Solution.java
Bit Manipulation Maximizing XOR Easy Solution.java
Bit Manipulation Counter game Medium Solution.java
Bit Manipulation Sum vs XOR Easy Solution.java
Bit Manipulation Sansa and XOR Medium Solution.java

Cracking the Coding Interview

Topic Challenge Points Solution
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
Techniques / Concepts Time Complexity: Primality 15 Solution.java
Techniques / Concepts Recrusion: 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

Subdomain Challenge Difficulty Solution
Arrays Arrays - DS Easy Solution.java
Arrays 2D Array - DS Easy Solution.java
Arrays Dynamic Array Easy Solution.java
Arrays Left Rotation Easy Solution.java
Arrays Sparse Arrays Medium Solution.java
Arrays Algorithmic Crush Hard Solution.java
Linked List Print the Elements of a Linked List Easy Solution.java
Linked List Insert a Node at the Tail of a Linked List Easy Solution.java
Linked List Insert a node at the head of a linked list Easy Solution.java
Linked List Insert a node at a specific position in a linked list Easy Solution.java
Linked List Delete a Node Easy Solution.java
Linked List Print in Reverse Easy Solution.java
Linked List Reverse a linked list Easy Solution.java
Linked List Compare two linked lists Easy Solution.java
Linked List Merge two sorted linked lists Easy Solution.java
Linked List Get Node Value Easy Solution.java
Linked List Delete duplicate-value nodes from a sorted linked list Easy Solution.java
Linked List Cycle Detection Medium Solution.java
Linked List Find Merge Point of Two Lists Easy Solution.java
Linked List Inserting a Node Into a Sorted Doubly Linked List Easy Solution.java
Linked List Reverse a doubly linked list Easy Solution.java
Trees Tree: Preorder Traversal Easy Solution.java
Trees Tree: Postorder Traversal Easy Solution.java
Trees Tree: Inorder Traversal Easy Solution.java
Trees Tree: Height of a Binary Tree Easy Solution.java
Trees Tree: Top View Easy Solution.java
Trees Tree: Level Order Traversal Easy Solution.java
Trees Binary Search Tree: Insertion Easy Solution.java
Trees Tree: Huffman Decoding Medium Solution.java
Trees Binary Search Tree: Lowest Common Ancestor Easy Solution.java
Trees Swap Nodes [Algo] Medium Solution.java
Trees Is This a Binary Search Tree? Medium Solution.java
Trees Square-Ten Tree Hard Solution.java
Stacks Maximum Element Easy Solution.java
Stacks Balanced Brackets Medium Solution.java
Queues Queue using Two Stacks Medium Solution.java
Heap Find the Running Median Hard Solution.java
Multiple Choice Data Structures MCQ 1 Hard Solution
Multiple Choice Data Structures MCQ 2 Hard Solution
Multiple Choice Data Structures MCQ 3 Hard Solution
Trie Contacts Medium 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
Data Structures Java Priority Queue 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