Amazon interview question

it was Basic leet code question