LendingKart interview question

Sort a k nearly sorted array