Category Archives: Arrays

Reverse each element of an array then sort the array in Python

Given an array arr1[] of size n, so firstly we have to reverse each element of an array, and store each of that reversed element in new arr2[] and then sort. Examples: Input : arr1[]={45,67,98,10} Output : after sorting=>{1,54,76,89} Explanation : arr1[]={45,67,98,10} so after reversing each element: arr2[]={54,76,89,1} after sorting arr2[] becomes: arr2={1,54,76,89} Input : arr1[]={20,56,90,19,42,67} Output :… Read More »