IBM Interview Question

Coding questions on hackerrank. couple hours to finish.