I am very new to programming, I just learned about it at the university. I have a problem when I have to recursively solve this problem in java (without using arrays, if, else, while, etc.)
So, the task is to sort numbers from 13542 to 12345.
public static void main(String[] args) {
System.out.println(sort(13542));
}
public static long sort(long n) {
return n < 10
? n
: sort(n, 0);
}
public static long sort(long n1, long n2) {
return n1 > 10
? xxx
: xxx;
}
The problem is that I have no idea what to do. I think my start is fine, but I have problems with the second method.
source
share