Cargill interview question

JavaScript related question and 2 DSA question