Motorola Mobility interview question

some pseudocode coding