Wildlife Studios interview question

The interview had some exercises from Hackerrank.