Help me to sort array!! 🙏🏼 (java) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help me to sort array!! 🙏🏼 (java)

I need to sort the elements of an array as follows: From: 0,1,2,3,4,5,6,7 To: 7,0,5,2,3,4,1,6 another example From: int[] x = {5,6,7,8,9,10,11}; To: Int[] a = {11,5,9,7,8,6,10}; I explain: the two biggest: 11 and 10 a[0]=11 a[6]=10 The two smallest: 5 and 6 a[1]=5 a[5]=6 The next biggest: 9 and 8 a[2]=9 a[4]=8 And the last...7 a[3]=7 But the length of the array will not always be the same. I try and try but I don't get it!!!!! Please!!! Help me!!! 🙏🏼🤦🏻‍♂️

9th Aug 2019, 12:28 AM
Eze
1 Answer
+ 1
~ swim ~ you're the best !!!! I was thinking something similar ... but I think that mess was more complicated and meaningless !!! Hahaha In a few hours I will try your advice and then tell you if I could. 💪💪
9th Aug 2019, 2:30 PM
Eze