Your question is Efficient Sorting with Index. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
NiCE CXone may need to rank interaction-quality scores before displaying the scores below a selected position. Given an integer array nums and a zero-based index k, sort nums in ascending order in place and return all elements whose sorted positions occur strictly after k.
Implement sort_and_return_after(nums, k) without using Python's built-in sorting functions. The algorithm must run in O(n log n) time and use O(1) auxiliary space, excluding the returned list.
nums, a mutable list of integers, and k, an integer index.nums[k + 1:]. The input list must be sorted in place.def sort_and_return_after(nums, k):