Pergunta de entrevista da empresa Disney+ Hotstar

1) Sort random array having 0,1 and 2 (gave him the working solution on IDE, he told me to give an optimized solution) Would like to advise the interviewer to first check google and see if the solution was optimized