Hackerrank – Find a Substring

Problem Statement A description of the problem can be found on Hackerrank. Solution For all lines cout all ocurrences of this regex pattern: \w+{substring}\w+ I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – Filling Jars

Problem Statement A description of the problem can be found on Hackerrank. Solution sum = (b – a + 1) * no_candies for each operations. Average and floor the sum. I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – Even Tree

Problem Statement A description of the problem can be found on Hackerrank. Solution Make a map of a node vs. the nnumber of nodes connected to it. Iterate over the map. If for the ith node, the number of nodes connected is even, then iterate over the nodes list connected to this node. Now for […]

Hackerrank – Equations

Problem Statement A description of the problem can be found on Hackerrank. Solution Make prime number factorization of N!. For help click here or here. I created solution in: Java JavaScript Ruby Scala All solutions are also available on my GitHub. Java

JavaScript

Ruby

Scala

Hackerrank – Detecting Valid Latitude and Longitude Pairs

Problem Statement A description of the problem can be found on Hackerrank. Solution My regex for validating longitude and latitude pairs: \([+-]?((90(\.0+)?)|([1-8][0-9](\.[0-9]+)?)|([0-9](\.[0-9]+)?)),\s*[+-]?(((([1-9][0-9])|([0-9]))(\.[0-9]+)?)|(1((80(\.0+)?)|([0-7][0-9](\.[0-9]+)?))))\) All solutions are also available on my GitHub.

Hackerrank – Connecting Towns

Problem Statement A description of the problem can be found on Hackerrank. Solution Count of all routes as multiplication of routes between towns. I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – Common Child

Problem Statement A description of the problem can be found on Hackerrank. Solution The implementation according to Longest Common Subsequence Problem. Ruby solutions is implemented with the same algorithm as Java solution. One hackerrank test with Ruby solution failed on timeout. I created solution in: Java Ruby All solutions are also available on my GitHub. […]

Hackerrank – Closest Numbers

Problem Statement A description of the problem can be found on Hackerrank. Solution Sort the input array ascending. For element at index i do difference with element at index i+1. Find the minimum difference. Check all elements and find all pair that have this minimum difference. Print found elements ascending. I created solution in: Java […]

Hackerrank – Building a List

Problem Statement A description of the problem can be found on Hackerrank. Solution I created solution in: Java JavaScript Ruby All solutions are also available on my GitHub. Java

JavaScript

Ruby