Newfront interview question

Standard leet code question Values check