+ 1
How can I do ascending array? From random numbers. In java
suppose I have input 7382190 and I want the result as 0123789 how?
5 ответов
+ 4
Look up some sorting algorithms, perhaps selection or bubble sort to start off.
Or, if you're lazy (😝) you can do:
import java.util.Collections;
Collections.sort(myArray);
+ 4
Same thing with the sorting algorithms (that doesn't change on language).
Or, the function would be:
myArray.sort()
+ 1
what'll be the solution if I wanna do it on py?
+ 1
thank u by the way 😊
0
Collections.reverse(myArray);
another useful bit. If you want your array to go highest to lowest