The Home Depot interview question

Code Scramble in pseudo code