trivago interview question

write a loop that performs a logic