Sollicitatievraag bij Oracle

Basic computer programming question and asked to solve hackerrank problem