Top to bottom viw

not able to pass test case 1 please do the required changes in code: