Tesla interview question

it was completing based on coding (coder pad)