Amazon Interview Question

Asked me to solve a puzzle