Hackerrank – Beautiful Days at the Movies

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution For each number in the given interval between i and j count the numbers with valid given condition. I created solution in: Scala Java JavaScript Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

[…]

Hackerrank – Compute the Perimeter of a Polygon

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Calculate a length of a line between each pair of following points p, defined with x and y coordinate: (p0, p1), (p1, p2), …, (pn-1, p0) Length of a line between two points: $$l = \sqrt{{(x_1 – x_2)}^2 + {(y_1 […]

Hackerrank – Compute the Area of a Polygon

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution Create matrices of point pairs as follows

… Calculate the determinat of each matrix: x1 * y2 – x2 * y1 And sum the determinants. In the end divide the sum with 2. Solution based on this. I […]

Hackerrank – Remove Duplicates

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

Hackerrank – Lambda Calculus – Reductions #4

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

Hackerrank – Lambda Calculus – Reductions #3

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

Hackerrank – Super Reduced String

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution I created an accumulator with initial value as empty string. I iterated through each character and updated the accumulator if an actual character is equals to last accumulator character, delete this character from the accumulator else append the character to […]

Hackerrank – Jumping on the Clouds

Hackerrank – Problem Statement A description of the problem can be found on Hackerrank. Solution I created a pointer for an actual position which starts at index 0. I always tried to jump at position i + 2. If it is not possible because of thundercloud I step at i + 1 position. I do […]