Hopper interview question

Some basic algorithms problem about terminal commands