Skip to content

sknsht/HackerRank

Repository files navigation

HackerRank

Solutions to problems on HackerRank

Java

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

Python

Subdomain Challenge Score Difficulty Solution
Introduction Say "Hello, World!" With Python 5 Easy Solution.py
Introduction Python If-Else 10 Easy Solution.py
Introduction Arithmetic Operators 10 Easy Solution.py
Introduction Python: Division 10 Easy Solution.py
Introduction Loops 10 Easy Solution.py
Introduction Write a function 10 Medium Solution.py
Introduction Print Function 20 Easy Solution.py
Basic Data Types List Comprehensions 10 Easy Solution.py
Basic Data Types Find the Runner-Up Score! 10 Easy Solution.py
Basic Data Types Nested Lists 10 Easy Solution.py
Basic Data Types Finding the percentage 10 Easy Solution.py
Basic Data Types Lists 10 Easy Solution.py
Basic Data Types Tuples 10 Easy Solution.py
Strings sWAP cASE 10 Easy Solution.py
Strings String Split and Join 10 Easy Solution.py
Strings What's Your Name? 10 Easy Solution.py
Strings Mutations 10 Easy Solution.py
Strings Find a string 10 Easy Solution.py
Strings String Validators 10 Easy Solution.py
Strings Text Alignment 10 Easy Solution.py
Strings Text Wrap 10 Easy Solution.py
Strings Designer Door Mat 10 Easy Solution.py
Strings String Formatting 10 Easy Solution.py
Strings Alphabet Rangoli 20 Easy Solution.py
Strings Capitalize! 20 Easy Solution.py
Strings The Minion Game 40 Medium Solution.py
Strings Merge the Tools! 40 Medium Solution.py
Sets Introduction to Sets 10 Easy Solution.py
Sets No Idea! 50 Medium Solution.py
Sets Symmetric Difference 10 Easy Solution.py
Sets Set .add() 10 Easy Solution.py
Sets Set .discard(), .remove() & .pop() 10 Easy Solution.py
Sets Set .union() Operation 10 Easy Solution.py
Sets Set .intersection() Operation 10 Easy Solution.py
Sets Set .difference() Operation 10 Easy Solution.py
Sets Set .symmetric_difference() Operation 10 Easy Solution.py
Sets Set Mutations 10 Easy Solution.py
Sets The Captain's Room 10 Easy Solution.py
Sets Check Subset 10 Easy Solution.py
Sets Check Strict Superset 10 Easy Solution.py
Math Polar Coordinates 10 Easy Solution.py
Math Find Angle MBC 10 Medium Solution.py
Math Triangle Quest 2 20 Medium Solution.py
Math Mod Divmod 10 Easy Solution.py
Math Power - Mod Power 10 Easy Solution.py
Math Integers Come In All Sizes 10 Easy Solution.py
Math Triangle Quest 20 Medium Solution.py
Itertools itertools.product() 10 Easy Solution.py
Itertools itertools.permutations() 10 Easy Solution.py
Itertools itertools.combinations() 10 Easy Solution.py
Itertools itertools.combinations_with_replacement() 10 Easy Solution.py
Itertools Compress the String! 20 Medium Solution.py
Itertools Iterables and Iterators 40 Medium Solution.py
Itertools Maximize It! 50 Hard Solution.py
Collections Collections.Counter() 10 Easy Solution.py
Collections DefaultDict Tutorial 20 Easy Solution.py
Collections Collections.namedtuple() 20 Easy Solution.py
Collections Collections.OrderedDict() 20 Easy Solution.py
Collections Word Order 50 Medium Solution.py
Collections Collections.deque() 20 Easy Solution.py
Collections Company Logo 30 Medium Solution.py
Collections Piling Up! 50 Medium Solution.py
Date and Time Calendar Module 10 Easy Solution.py
Date and Time Time Delta 30 Medium Solution.py
Errors and Exceptions Exceptions 10 Easy Solution.py
Errors and Exceptions Incorrect Regex 20 Easy Solution.py
Classes Classes: Dealing with Complex Numbers 20 Medium Solution.py
Classes Class 2 - Find the Torsional Angle 20 Easy Solution.py
Built-Ins Zipped! 10 Easy Solution.py
Built-Ins Input() 20 Easy Solution.py
Built-Ins Python Evaluation 20 Easy Solution.py
Built-Ins Athlete Sort 30 Medium Solution.py
Built-Ins Any or All 20 Easy Solution.py
Built-Ins ginortS 40 Medium Solution.py
Python Functionals Map and Lambda Function 20 Easy Solution.py
Python Functionals Validating Email Addresses With a Filter 20 Medium Solution.py
Python Functionals Reduce Function 30 Medium Solution.py
Regex and Parsing Detect Floating Point Number 20 Easy Solution.py
Regex and Parsing Re.split() 20 Easy Solution.py
Regex and Parsing Group(), Groups() & Groupdict() 20 Easy Solution.py
Regex and Parsing Re.findall() & Re.finditer() 20 Easy Solution.py
Regex and Parsing Re.start() & Re.end() 20 Easy Solution.py
Regex and Parsing Regex Substitution 20 Medium Solution.py
Regex and Parsing Validating Roman Numerals 20 Easy Solution.py
Regex and Parsing Validating phone numbers 20 Easy Solution.py
Regex and Parsing Validating and Parsing Email Addresses 20 Easy Solution.py
Regex and Parsing Hex Color Code 30 Easy Solution.py
Regex and Parsing HTML Parser - Part 1 30 Easy Solution.py
Regex and Parsing HTML Parser - Part 2 30 Easy Solution.py
Regex and Parsing Detect HTML Tags, Attributes and Attribute Values 30 Easy Solution.py
Regex and Parsing Validating UID 40 Easy Solution.py
Regex and Parsing Validating Credit Card Numbers 40 Medium Solution.py
Regex and Parsing Validating Postal Codes 80 Hard Solution.py
Regex and Parsing Matrix Script 100 Hard Solution.py
XML XML 1 - Find the Score 20 Easy Solution.py
XML XML2 - Find the Maximum Depth 20 Easy Solution.py
Closures and Decorators Standardize Mobile Number Using Decorators 30 Easy Solution.py
Closures and Decorators Decorators 2 - Name Directory 30 Easy Solution.py
Numpy Arrays 20 Easy Solution.py
Numpy Shape and Reshape 20 Easy Solution.py
Numpy Transpose and Flatten 20 Easy Solution.py
Numpy Concatenate 20 Easy Solution.py
Numpy Zeros and Ones 20 Easy Solution.py
Numpy Eye and Identity 20 Easy Solution.py
Numpy Array Mathematics 20 Easy Solution.py
Numpy Floor, Ceil and Rint 20 Easy Solution.py
Numpy Sum and Prod 20 Easy Solution.py
Numpy Min and Max 20 Easy Solution.py
Numpy Mean, Var, and Std 20 Easy Solution.py
Numpy Dot and Cross 20 Easy Solution.py
Numpy Inner and Outer 20 Easy Solution.py
Numpy Polynomials 20 Easy Solution.py
Numpy Linear Algebra 20 Easy Solution.py
Debugging Words Score 10 Medium Solution.py
Debugging Default Arguments 30 Medium Solution.py

SQL

Subdomain Challenge Score Difficulty Solution
Basic Select Revising the Select Query I 10 Easy Solution.sql
Basic Select Revising the Select Query II 10 Easy Solution.sql
Basic Select Select All 10 Easy Solution.sql
Basic Select Select By ID 10 Easy Solution.sql
Basic Select Japanese Cities' Attributes 10 Easy Solution.sql
Basic Select Japanese Cities' Names 10 Easy Solution.sql
Basic Select Weather Observation Station 1 15 Easy Solution.sql
Basic Select Weather Observation Station 3 10 Easy Solution.sql
Basic Select Weather Observation Station 4 10 Easy Solution.sql
Basic Select Weather Observation Station 5 30 Easy Solution.sql
Basic Select Weather Observation Station 6 10 Easy Solution.sql
Basic Select Weather Observation Station 7 10 Easy Solution.sql
Basic Select Weather Observation Station 8 15 Easy Solution.sql
Basic Select Weather Observation Station 9 10 Easy Solution.sql
Basic Select Weather Observation Station 10 10 Easy Solution.sql
Basic Select Weather Observation Station 11 15 Easy Solution.sql
Basic Select Weather Observation Station 12 15 Easy Solution.sql
Basic Select Higher Than 75 Marks 15 Easy Solution.sql
Basic Select Employee Names 10 Easy Solution.sql
Basic Select Employee Salaries 10 Easy Solution.sql
Advanced Select The PADS 30 Medium Solution.sql
Advanced Select Type of Triangle 20 Easy Solution.sql
Advanced Select Occupations 30 Medium Solution.sql
Advanced Select Binary Tree Nodes 30 Medium Solution.sql
Advanced Select New Companies 30 Medium Solution.sql
Aggregation Revising Aggregations - The Count Function 10 Easy Solution.sql
Aggregation Revising Aggregations - The Sum Function 10 Easy Solution.sql
Aggregation Revising Aggregations - Averages 10 Easy Solution.sql
Aggregation Average Population 10 Easy Solution.sql
Aggregation Japan Population 10 Easy Solution.sql
Aggregation Population Density Difference 10 Easy Solution.sql
Aggregation The Blunder 15 Easy Solution.sql
Aggregation Top Earners 20 Easy Solution.sql
Aggregation Weather Observation Station 2 15 Easy Solution.sql
Aggregation Weather Observation Station 13 10 Easy Solution.sql
Aggregation Weather Observation Station 14 10 Easy Solution.sql
Aggregation Weather Observation Station 15 15 Easy Solution.sql
Aggregation Weather Observation Station 16 10 Easy Solution.sql
Aggregation Weather Observation Station 17 15 Easy Solution.sql
Aggregation Weather Observation Station 18 25 Medium Solution.sql
Aggregation Weather Observation Station 19 30 Medium Solution.sql
Aggregation Weather Observation Station 20 40 Medium Solution.sql
Basic Join Asian Population 10 Easy Solution.sql
Basic Join African Cities 10 Easy Solution.sql
Basic Join Average Population of Each Continent 10 Easy Solution.sql
Basic Join The Report 20 Medium Solution.sql
Basic Join Top Competitors 30 Medium Solution.sql
Basic Join Ollivander's Inventory 30 Medium Solution.sql
Basic Join Challenges 30 Medium Solution.sql
Basic Join Contest Leaderboard 30 Medium Solution.sql
Advanced Join Projects 40 Medium Solution.sql
Advanced Join Placements 40 Medium Solution.sql
Advanced Join Symmetric Pairs 40 Medium Solution.sql
Advanced Join Interviews 50 Hard Solution.sql
Advanced Join 15 Days of Learning SQL 50 Hard Solution.sql
Alternative Queries Draw The Triangle 1 25 Easy Solution.sql
Alternative Queries Draw The Triangle 2 25 Easy Solution.sql
Alternative Queries Print Prime Numbers 40 Medium Solution.sql

Cracking the Coding Interview

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

Interview Preparation Kit

Subdomain Challenge Score Difficulty Solution
Warm-up Challenges Sock Merchant 10 Easy Solution.java
Warm-up Challenges Counting Valleys 15 Easy Solution.java
Warm-up Challenges Jumping on the Clouds 20 Easy Solution.java
Warm-up Challenges Repeated String 20 Easy Solution.java
Arrays 2D Array - DS 15 Easy Solution.java
Arrays Arrays: Left Rotation 20 Easy Solution.java
Arrays New Year Chaos 40 Medium Solution.java
Arrays Minimum Swaps 2 40 Medium Solution.java
Arrays Array Manipulation 60 Hard Solution.java
Dictionaries and Hashmaps Hash Tables: Ransom Note 25 Easy Solution.java
Dictionaries and Hashmaps Two Strings 25 Easy Solution.java
Dictionaries and Hashmaps Sherlock and Anagrams 50 Medium Solution.java
Sorting Sorting: Bubble Sort 30 Easy Solution.java
Sorting Mark and Toys 35 Easy Solution.java
Sorting Sorting: Comparator 35 Medium Solution.java
Sorting Merge Sort: Counting Inversions 45 Hard Solution.java
String Manipulation Strings: Making Anagrams 25 Easy Solution.java
String Manipulation Alternating Characters 20 Easy Solution.java
Greedy Algorithms Minimum Absolute Difference in an Array 15 Easy Solution.java
Greedy Algorithms Luck Balance 20 Easy Solution.java
Greedy Algorithms Greedy Florist 35 Medium Solution.java
Greedy Algorithms Max Min 35 Medium Solution.java
Search Hash Tables: Ice Cream Parlor 35 Medium Solution.java
Search Pairs 50 Medium Solution.java
Dynamic Programming Max Array Sum 20 Medium Solution.java
Dynamic Programming Candies 50 Medium Solution.java
Stacks and Queues Balanced Brackets 25 Medium Solution.java
Stacks and Queues Queues: A Tale of Two Stacks 30 Medium Solution.java
Graphs BFS: Shortest Reach in a Graph 45 Hard Solution.java
Graphs DFS: Connected Cell in a Grid 45 Hard Solution.java
Trees Tree: Height of a Binary Tree 10 Easy Solution.java
Trees Trees: Is This a Binary Search Tree? 30 Medium Solution.java
Trees Binary Search Tree: Lowest Common Ancestor 30 Easy Solution.java
Linked Lists Linked Lists: Detect a Cycle 25 Easy Solution.java
Linked Lists Reverse a Doubly Linked List 5 Easy Solution.java
Linked Lists Find Merge Point of Two Lists 5 Easy Solution.java
Recursion and Backtracking Recursion: Fibonacci Numbers 15 Easy Solution.java
Recursion and Backtracking Recursion: Davis' Staircase 30 Medium Solution.java
Miscellaneous Flipping bits 40 Easy Solution.java
Miscellaneous Time Complexity: Primality 30 Medium Solution.java

Functional Programming

Subdomain Challenge Score Difficulty Solution
Introduction Solve Me First FP 3 Easy Solution.scala
Introduction Hello World 5 Easy Solution.scala