you give 0indexed integer array num Rearrange value num accord follow rulessort value odd index num nonincrease orderfor example num 4123 step 4321 the value odd index 1 3 sort nonincrease ordersort value index num nondecrease orderfor example num 4123 step 2143 the value indice 0 2 sort nondecrease orderreturn array form rearrange value num Example 1input num 4123output 2341explanation first sort value present odd index 1 3 nonincreasing orderso num change 4123 4321next sort value present index 0 2 nondecrease orderso num change 4123 2341thus array form rearrange value 2341example 2input num 21output 21explanation since exactly odd index index rearrangement value take placethe resultant array form 21 initial array Constraints1 numslength 1001 numsi 100