Tripadvisor interview question

a simple porblem