Adobe interview question

to write pseudocode for the not optimal solution