Hackerrank - Pascal's Triangle

Problem Statement A description of the problem can be found on Hackerrank. Solution I created recursive function for factorial . Then create all combinations of rows and column indexes. For input 4 it looks like:

Apply function for pascal triangle for each combination. I created solution in Scala: The solution is also available on […]

Hackerrank - Solve me first & second

This is a summary post of first Hackerrank intruductory challenges - Solve me first, Solve me second. It is only required to select your favourite programming language. You get a template and just submit this code. Both solutions: Solve me first Solve me second Also available on my GitHub here and here. Solve me first […]

Hackerrank - A Very Big Sum

Problem Statement A description of the problem can be found on Hackerrank. Solution Read from input and sum all numbers. Same as Simple Array Sum, but you have to use bigger integer type as 32-bit integer if language does not support automatic conversion to Big Integers as default I created solution in 4 languages: Scala […]

Hackerrank - Extra Long Factorials

Problem Statement A description of the problem can be found on Hackerrank. Solution Read input and implement factorial function (recursive or imperative) using Big Integer if desired language does not support automatic conversion to Big Integers by default. I created solution in 3 languages: Scala Java Ruby Normally, I implement a solution also in JavaScript. […]

Hackerrank - Library Fine

Problem Statement A description of the problem can be found on Hackerrank. Solution Read 2 lines and parse dates. Substract actual year, month, day and expected year, month and day. Compare values and calculate fee: - if year difference is greater than 0 theb return 10000 - if year difference is equal to 0 and […]

Hackerrank - Time Conversion

Problem Statement A description of the problem can be found on Hackerrank. Solution My solution is folllowing: After reading an input line I parsed are necessary values. hours part of the input time from 0th to index of first ':' minutes part of the input time from index of first ':' + 1 to index […]

Hackerrank - Simple Array Sum

Problem Statement A description of the problem can be found on Hackerrank. Solution As this challenge is in Warmup subdomain, solution is pretty easy. The only thing to do is to be able to read from input given n times and make sum of all numbers. I created solution in 4 languages: Scala Java JavaScript […]