Fun with Sorting
CodeChefOpen on judge ↗
Divide the given array of size equal to the sum of first n natural numbers into subarrays of size 1,2,3,....,n. For the xth subarray of size x – if x is odd then sort it in descending order, otherwise sort it in ascending order. Output the sum of 1st element of each subarray. Input - The number of test cases t is entered first. - For each of the t lines that follow, value of n is given – after
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start