← SAP questions
CodingReported in a candidate post, Sep 2023

Sort first k values ascending and remaining descending

Filed under SAP

Given an array of $n$ integers and an integer $k$, sort the first $k$ elements of the array in ascending order and the remaining $n-k$ elements in descending order. The sorting should be done in-place…

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 SAP questions

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