Lam Research interview question

Sort k nearest neighbours in an array