Hackerrank – Mini-Max Sum

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution If you order the given array ascending – the min sum are first n-1 elements – the max sum are last n-1 elements I created solution in: Scala Java JavaScript Ruby All solutions are also available on my GitHub. Java […]

Hackerrank – Bon Appétit

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution First find a correct amount of money – (food_sum – index_of_allergic) / 2. Compare if the correct amount is equals with given amount. I created solution in: Scala Java JavaScript Ruby All solutions are also available on my GitHub. Java […]

Hackerrank – Sequence full of colors

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Create a recursive function with condition described – see implementation. I created solution in: Scala All solutions are also available on my GitHub. Scala

Hackerrank – Jumping Bunnies

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Calculate the Least Common Multiple of bunnies jumps. I created solution in: Scala All solutions are also available on my GitHub. Scala

Hackerrank – Repeated String

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution The length of a given word repeated could be too much to be able to calculate the result before the time limit. We need to simplify our solution. We have a given string – s. Count only “a” characters in […]

Hackerrank – Viral Advertising

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution For each day calculate how many people like the advertisement. Use the formula from problem description. Then sum all people. I created solution in: Scala Java JavaScript Ruby All solutions are also available on my GitHub. Java

JavaScript

[…]

Hackerrank – Apple and Orange

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution You need to calculate how many apples or oranges are within given positions on a line. There is a following condition:     I created solution in: Scala Java JavaScript Ruby All solutions are also available on my GitHub. Java […]

Hackerrank – Equalize the Array

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Create groups containing same numbers from defined array. The result is length of the array without size of the biggest groups. Explanation: The only way to make a minimum deletion of other numbers from array. If I would delete any […]

Hackerrank – Sock Merchant

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution I created groups of socks with same color. Then for each of the group I calculated sock pairs – number_of_socks / 2. The result is the count of all pairs. I created solution in: Scala Java JavaScript Ruby All solutions […]

Hackerrank – Designer PDF Viewer

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Find a max height of given characters. Square is max height multiplied with length of the string. I created solution in: Scala Java JavaScript Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby […]