← Amazon questions

Check if array can be sorted by swapping elements at distance k

Filed under Amazon

Given an array of integers and an integer k, determine if the array can be sorted by repeatedly swapping pairs of elements that are at distance k (i.e., indices i and i+k). If possible, return the…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.