Tripadvisor Interview Question

a simple porblem