Hackerrank Solutions

Hackerrank is a site where you can test your programming skills and learn something new in many domains.

I found this page around 2014 and after then I exercise my brain for FUN. My Hackerrank profile.

I created almost all solutions in 4 programming languages - Scala, Javascript, Java and Ruby. Special challenges require SQL, Bash or just plain text. Posts contain explanations, too.

The solutions follows Hackerrank structure. You can find all implementations on my Github

## Project Euler+

- Project Euler #1: Multiples of 3 and 5
- Project Euler #2: Even Fibonacci numbers
- Project Euler #3: Largest prime factor
- Project Euler #4: Largest palindrome product
- Project Euler #5: Smallest multiple
- Project Euler #6: Sum square difference
- Project Euler #7: 10001st prime
- Project Euler #8: Largest product in a series
- Project Euler #9: Special Pythagorean triplet
- Project Euler #10: Summation of primes
- Project Euler #11: Largest product in a grid
- Project Euler #12: Highly divisible triangular number
- Project Euler #13: Large sum
- Project Euler #14: Longest Collatz sequence
- Project Euler #15: Lattice paths
- Project Euler #16: Power digit sum
- Project Euler #17: Number to Words
- Project Euler #18: Maximum path sum I
- Project Euler #19: Counting Sundays
- Project Euler #20: Factorial digit sum
- Project Euler #22: Names scores
- Project Euler #36: Double-base palindromes
- Project Euler #67: Maximum path sum II

## Algorithms

#### Warmup

- [Easy] Solve me first (1 pt)
- [Easy] Simple Array Sum (10 pts)
- [Easy] Staircase (10 pts)
- [Easy] Diagonal Difference (10 pts)
- [Easy] A Very Big Sum (10 pts)
- [Easy] Plus Minus (10 pts)
- [Easy] Time Conversion (15 pts)
- [Easy] Compare The Triples (10 pts)
- [Easy] Circular Array Rotation (20 pts)
- [Easy] Birthday Cake Candles (10 pts)

#### Implementation

- [Easy] Divisible Sum Pairs (10 pts)
- [Easy] Sequence Equation (20 pts)
- [Easy] Lisa's Workbook (30 pts)
- [Easy] Library Fine (15 pts)
- [Easy] Caesar Cipher (15 pts)
- [Easy] Angry Professor (20 pts)
- [Medium] Extra long factorials (20 pts)
- [Easy] Service Lane (20 pts)
- [Easy] Utopian Tree (20 pts)
- [Easy] Chocolate Feast (25 pts)
- [Easy] Modified Kaprekar Numbers (30 pts)
- [Easy] Sherlock and Squares (20 pts)
- [Easy] Manasa and Stones (30 pts)
- [Easy] Cut the sticks (25 pts)
- [Easy] Find Digits (25 pts)
- [Easy] Cavity Map (30 pts)
- [Easy] Sherlock and The Beast (30 pts)
- [Medium] Encryption (30 pts)
- [Easy] Strange Counter (30 pts)
- [Easy] Beautiful Triplets (20 pts)
- [Easy] Kangaroo (10 pts)
- [Easy] Save the Prisoner! (15 pts)
- [Easy] Minumum Distances (20 pts)
- [Easy] Jumping on the Clouds (20 pts)
- [Easy] Jumping on the Clouds: Revisited (15 pts)
- [Easy] Sock Merchant (10 pts)
- [Easy] Repeated String (20 pts)
- [Easy] Equalize the Array (20 pts)
- [Easy] Viral Advertising (15 pts)
- [Easy] Apple and Orange (10 pts)
- [Easy] Mini-Max Sum (10 pts)
- [Easy] Bon Appétit (10 pts)
- [Easy] Beautiful Days at the Movies (15 pts)
- [Easy] Designer PDF Viewer (20 pts)
- [Easy] Flatland Space Stations (25 pts)
- [Easy] Grading Students (10 pts)
- [Easy] Between Two Sets (10 pts)
- [Easy] The Hurdle Race (15 pts)
- [Easy] Taum and B'day (25 pts)
- [Easy] ACM ICPC Team (25 pts)
- [Easy] Drawing Book (10 pts)
- [Easy] Day of the Programmer (15 pts)
- [Easy] Electronics Shop (15 pts)
- [Easy] Migratory Birds (10 pts)
- [Easy] Picking Numbers (20 pts)
- [Easy] Birthday Chocolate (10 pts)
- [Easy] Breaking the Records (10 pts)
- [Easy] Cats and a Mouse (15 pts)
- [Easy] Counting Valleys (15 pts)

#### Strings

- [Easy] Super Reduced String (10 pts)
- [Easy] CamelCase (15 pts)
- [Easy] The Love-Letter Mystery (20 pts)
- [Easy] Alternating Characters (20 pts)
- [Easy] Gemstones (20 pts)
- [Easy] Pangrams (20 pts)
- [Easy] Game of Thrones - I (30 pts)
- [Easy] Funny String (25 pts)
- [Easy] Anagram (25 pts)
- [Easy] Beautiful Binary String (20 pts)
- [Easy] Mars Exploration (15 pts)
- [Easy] String Construction (25 pts)
- [Easy] Weighted Uniform Strings (20 pts)
- [Medium] Sherlock and Anagrams (50 pts)
- [Difficult] Common Child (60 pts)

#### Sorting

- [Easy] Intro to Tutorial Challenges (30 pts)
- [Easy] Insertion Sort - Part 1 (30 pts)
- [Easy] Closest Numbers (35 pts)

#### Search

#### Graph Theory

#### Greedy

- [Medium] Flowers (35 pts)
- [Medium] Max Min (35 pts)
- [Easy] Two Arrays (40 pts)
- [Easy] Priyanka and Toys (30 pts)
- [Easy] Mark and Toys (35 pts)

#### Dynamic Programming

#### Bit Manipulation

- [Easy] Lonely Integer (20 pts)
- [Easy] Maximizing XOR (30 pts)
- [Easy] Flipping Bits (40 pts)
- [Easy] Sum vs XOR (25 pts)

## Data Structures

#### Arrays

#### Linked Lists

## Mathematics

#### Fundamentals

- [Easy] Find Point (5 pts)
- [Easy] Minimum Draws (5 pts)
- [Easy] Connecting Towns (10 pts)
- [Easy] Handshake (10 pts)
- [Easy] Halloween Party (20 pts)
- [Easy] Filling Jars (20 pts)
- [Medium] Is Fibo (20 pts)

#### Number Theory

#### Combinatorics

- [Expert] Building a List (40 pts)
- [Easy] Picking Cards (50 pts)
- [Medium] Consecutive Subsequences (50 pts)

#### Probability

## Java

#### Introduction

- [Easy] Welcome To Java! (3 pts)
- [Easy] Java If-Else (10 pts)
- [Easy] Java Stdin and Stdout 1 (5 pts)
- [Easy] Java Stdin and Stdout 2 (10 pts)
- [Easy] Java Output Formatting (10 pts)
- [Easy] Java Loops I (10 pts)
- [Easy] Java Loops II (10 pts)
- [Easy] Java Datatypes (10 pts)
- [Easy] Java End-of-file (10 pts)
- [Easy] Java Static Initializer Block (10 pts)
- [Easy] Java Int to String (10 pts)
- [Easy] Java Date and Time (15 pts)
- [Easy] Java Currency Formatter (15 pts)

#### Strings

## SQL

#### Basic Select

- [Easy] Select All (10 pts)
- [Easy] Revising the Select Query - 1 (10 pts)
- [Easy] Revising the Select Query - 2 (10 pts)
- [Easy] Select by ID (10 pts)
- [Easy] Japanese Cities' Detail (10 pts)
- [Easy] Japanese Cities' Names (10 pts)
- [Easy] Weather Observation Station 1 (15 pts)
- [Easy] Weather Observation Station 3 (10 pts)
- [Easy] Weather Observation Station 4 (10 pts)
- [Medium] Weather Observation Station 5 (30 pts)
- [Easy] Weather Observation Station 6 (10 pts)
- [Easy] Weather Observation Station 7 (10 pts)
- [Easy] Weather Observation Station 8 (15 pts)
- [Easy] Weather Observation Station 9 (10 pts)
- [Easy] Weather Observation Station 10 (10 pts)
- [Easy] Weather Observation Station 11 (15 pts)
- [Easy] Weather Observation Station 12 (15 pts)
- [Medium] Higher Than 75 Marks (15 pts)

<

h2>Linux Shell

#### Bash

- [Easy] Let's Echo (1 pt)
- [Easy] Looping and Skipping (2 pts)
- [Easy] A Personalized Echo (1 pt)
- [Easy] Looping with Numbers (2 pts)
- [Easy] The World of Numbers (2 pts)
- [Easy] Comparing Numbers (3 pts)
- [Easy] Getting started with conditionals (3 pts)

#### Text Processing

- [Easy] Cut #1 (1 pt)
- [Easy] Cut #2 (1 pt)
- [Easy] Head of a Text File #1 (2 pts)
- [Easy] Head of a Text File #2 (2 pts)
- [Easy] Tr' Command #1 (1 pt)
- [Easy] Sort Command #1 (1 pt)
- [Easy] Sort Command #2 (1 pt)
- [Easy] Tr' Command #2 (1 pt)

#### Grep Sed Awk

## Functional Programming

#### Introduction

- [Easy] Solve me first FP (3 pts)
- [Easy] Lambda Calculus - Evaluating Expressions #1 (5 pts)
- [Easy] Lambda Calculus - Evaluating Expressions #2 (5 pts)
- [Easy] Lambda Calculus - Evaluating Expressions #3 (5 pts)
- [Medium] Lambda Calculus - Evaluating Expressions #4 (5 pts)
- [Medium] Lambda Calculus - Evaluating Expressions #5 (5 pts)
- [Easy] Lambda Calculus - Reductions #1 (5 pts)
- [Easy] Lambda Calculus - Reductions #2 (5 pts)
- [Medium] Lambda Calculus - Reductions #3 (5 pts)
- [Medium] Lambda Calculus - Reductions #4 (5 pts)
- [Easy] Hello World (5 pts)
- [Easy] Hello World N Times (5 pts)
- [Easy] List Replication (10 pts)
- [Easy] Filter Array (10 pts)
- [Easy] Update List (10 pts)
- [Easy] List Length (10 pts)
- [Easy] Array Of N Elements (10 pts)
- [Easy] Reverse a list (10 pts)
- [Easy] Sum of odd elements (10 pts)
- [Easy] Filter positions in a list (10 pts)
- [Easy] Evaluating e^x (20 pts)
- [Easy] Area Under Curves and Volume of Revolving a Curve (30 pts)
- [Easy] Functions or Not (5 pts)
- [Easy] Compute the Perimeter of a Polygon (15 pts)
- [Easy] Compute the Area of a Polygon (20 pts)

#### Recursion

- [Easy] Computing the GCD (2 pts)
- [Easy] Fibonacci Numbers (2 pts)
- [Easy] Pascal's Triangle (10 pts)
- [Easy] String Mingling (20 pts)
- [Easy] String-o-Permute (10 pts)
- [Easy] String Reductions (10 pts)
- [Easy] Prefix Compression (10 pts)
- [Easy] Sequence full of colors (10 pts)
- [Easy] String Compression (10 pts)
- [Medium] Super Digit (20 pts)

#### Ad Hoc

- [Easy] Remove Duplicates (10 pts)
- [Easy] Rotate String (20 pts)
- [Easy] Jumping Bunnies (20 pts)
- [Easy] Missing Numbers (FP) (30 pts)

## Regex

#### Introduction

- [Easy] Matching Specific String (5 pts)
- [Easy] Matching Word & Non-Word Character (5 pts)
- [Easy] Matching Digits & Non-Digit Characters (5 pts)
- [Easy] Matching Whitespace & Non-Whitespace Character (5 pts)
- [Easy] Matching Anything But a Newline (5 pts)
- [Easy] Matching Start & End (5 pts)

#### Character Class

- [Easy] Matching Specific Characters (10 pts)
- [Easy] Excluding Specific Characters (10 pts)
- [Easy] Matching Range Of Characters (10 pts)

#### Repetitions

- [Easy] Matching {x} Repetitions (20 pts)
- [Easy] Matching {x,y} Repetitions (20 pts)
- [Easy] Matching Zero Or More Repetitions (20 pts)
- [Easy] Matching One Or More Repetitions (20 pts)
- [Easy] Matching Ending Items (20 pts)

#### Grouping and Capturing

- [Easy] Matching Word Boundaries (20 pts)
- [Easy] Capturing & Non-Capturing Groups (20 pts)
- [Easy] Alternative Matching (20 pts)

#### Applications

- [Easy] HackerRank Tweets (5 pts)
- [Easy] Split the Phone Numbers (5 pts)
- [Easy] Find Hackerrank (5 pts)
- [Easy] The British and American Style of Spelling (5 pts)
- [Easy] Find a Substring (5 pts)
- [Easy] Alien Username (5 pts)
- [Easy] Detecting Valid Latitude and Longitude Pairs (20 pts)
- [Easy] Valid PAN Format (5 pts)
- [Easy] IP Address Validation (10 pts)
- [Easy] Detect HTML Attributes (10 pts)
- [Easy] Detect HTML Tags (10 pts)