+ 2
What's wrong??
5 Respostas
+ 4
Swap function does not effect on original values, Since you are doing it by call by value, not by reference.
Swap values in loop itself...
Edit: alternatively use @zemiak suggestion.
+ 3
You can do directly by print string backwards.
-----------------------------------------------------
-----------------------------------------------------
for(int i = s.length()-1; i>=0; i--){
System.out.print(s.charAt(i));
}
-----------------------------------------------------
-----------------------------------------------------
+ 2
use
swap(c, i, j);
...
public static void swap(char[] arr, int a, int b){
+ 2
Thank guys