Lets say I have an array : a=[[1,2,3],[4,5]]
and I have another array : b=[[2.5,1.5,3.5],[1.5,2.5]]
I need to sort ‘a’ with respect to ‘b’.
i.e the output should be = [[3,1,2],[5,4]]
I tried but my code seemed to be very lengthy. It would be great if you could help me out.Thanks!
This gives your sample output for your sample input, so hopefully it’s what you want (it sorts the values of each subarray in the first array by the value at the same position in the corresponding subarray of the second array, descendingly):