Hackerrank – Divisible Sum Pairs

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Create index pairs variations for all indexes that pair is unique – it means when (i, j) exists (j, i) is the same. For each pair calculate the sum of values at corresponding index. If is divisible, count them and […]

Hackerrank – CamelCase

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution There are 2 options To split the string by regular expression”[A-Z]” and then print the length of an array returned from splitting. To iterate over all characters, count the uppercase and print their count + 1 I created solution in: […]

Hackerrank – Week of Code 22

I participated in an another programming contest organized by Hackerrank. It was Week of Code 22 from 8.8.2016, 09:00 AM CEST to 15.8.2016 AM CEST It was my 14th contest at Hackerrank and I think I was quite successfull because I earned my second bronze medal. I was able to solve 3 challenges: Cookie Party […]

Hackerrank – Compare The Triplets

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Read all ratings and compare it according to the defined conditions: If ai > bi, then Alice is awarded 1 point If ai < bi, then Bob is awarded 1 point If ai = bi, then neither person receives a […]

Hackerrank – The Maximum Subarray

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Contiguous sum – using Kadane’s algorithm Non-contiguous sum – filter all positive elements from given array and sum them. If this array is empty. Take the greatest element. I created solution in: Scala Java JavaScript Ruby All solutions are also […]

Hackerrank – Functions Or Not?

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Check if for a given value x is always only one function output value y. See function definition. I created solution in: Scala All solutions are also available on my GitHub. Scala

Hackerrank – String-o-Permute

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution For every input line: divide into character pairs reverse order of characters concat the pairs it into the one string I created solution in: Scala All solutions are also available on my GitHub. Scala

Hackerrank – String Mingling

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Iterate through one of the strings and concatenate each actual character. I created solution in: Scala All solutions are also available on my GitHub. Scala

Hackerrank – Area Under Curves and Volume of Revolving a Curve

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution function f is an applied algebraic expression to x as in problem description function area is area of the cycle ($$\Pi r^2$$) with center 0 and radius value of function(x) function summation is applied once for function f and one […]

Hackerrank – Cut the sticks

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Until the sticks array is empty: print the length of sticks array sort the array get the minimum value as first element of the array cut the array filtering only values greater than minimum I created solution in: Scala Java […]