Taller Technologies interview question

How to solve this pseudo code I posted in chat: