/hackerrank

hackerrank solutions

Primary LanguageJava


302 efficient solutions to HackerRank problems

Solutions are coded using Java 8

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 The Love-Letter Mystery 20 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 Tree: Top View 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 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 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 Viral Advertising 15 Solution.java
Basic Programming Beautiful Days at the Movies 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 Beautiful Triplets 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 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 Manasa and Stones 30 Solution.java
RegEx HackerRank in a String! 20 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

Thanks to https://github.com/RodneyShag/ for template.