Element5 interview question

Array exchanging and indexing puzzle on reasoning