Tap here to switch tabs
Problem
Submissions

Problem: Sort Even and Odd Indices Independently

med
30 min
Try to solve the Sort Even and Odd Indices Independently problem.

Statement

You are given a 00 indexed integer array nums. Rearrange the elements of nums according to the following rules:

  • Sort the values present at odd indices in descending order.

  • Sort the values present at even indices in ascending order.

Return the modified array nums after applying these rearrangements.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort Even and Odd Indices Independently

med
30 min
Try to solve the Sort Even and Odd Indices Independently problem.

Statement

You are given a 00 indexed integer array nums. Rearrange the elements of nums according to the following rules:

  • Sort the values present at odd indices in descending order.

  • Sort the values present at even indices in ascending order.

Return the modified array nums after applying these rearrangements.

Constraints:

  • 1≤1 \leq nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100