Hackerrank - Counting Valleys

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution I loop throught all steps and remeber the level from the sea (level). If it is D, I decrement by 1, if U increment by 1. When such situation happen that actual sea level is 0 and current step is […]

Hackerrank - Cats and a Mouse

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution Cats and the mouse moves with the same speed. Suppose it is by 1 on x-axis. Lets define the difference between their positions: (cat A, mouse), (cat B, mouse). where , , are coordinates on -axis. The results - If […]

Hackerrank - Breaking the Records

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution Look at the implementation. The steps are in problem description. I created solution in: Scala Java Javascript All solutions are also available on my GitHub profile. Scala

Java

Javascript

Hackerrank - Birthday Chocolate

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution Look at the implementation. The steps are in problem description. I created solution in: Scala Java Javascript All solutions are also available on my GitHub profile. Scala

Java

Javascript

Hackerrank - Picking Numbers

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution First, I started with sorting the array. I took 0th index as a pointer. I had the second pointer as 1st index. I incremented second pointer and tried to find out if the difference between values at the pointers is […]

Hackerrank - Migratory Birds

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution Look at the implementation. The steps are in problem description. I created solution in: Scala Java Javascript All solutions are also available on my GitHub profile. Scala

Java

Javascript

Hackerrank - Mark and Toys

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution I started with sorting the toys prices ascending. I looked at the prices from the beginning and sum the prices. If I exceeded the required given sum, I outputed the amount of toys. I created solution in: Scala Java Javascript […]

Hackerrank - Electronics Shop

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution I do what is described in problem description. Look at the implementation. I created solution in: Scala Java Javascript All solutions are also available on my GitHub profile. Scala

Java

Javascript

Hackerrank - Day of the Programmer

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution Look at the implementation. The steps are in problem description. I created solution in: Scala Java Javascript All solutions are also available on my GitHub profile. Scala

Java

Javascript

Hackerrank - Drawing Book

Hackerrank - Problem Statement A description of the problem can be found on Hackerrank. Solution The equation to calculate no. of draws, when I started from the front of the book: no. of draws, when I started from the back of the book: if is even else I created solution in: Scala Java Javascript All […]