Solution of functional programming problems from Hackerrank