TikTok interview question

An unsorted array problem using any language to solve.