Sponsored
Use these hints if you're stuck. Try solving on your own first.
From a greedy perspective, what k elements should you pick?
Could you sort the array while maintaining the index?
Solve with full IDE support and test cases