문자열 뒤집기
-
문자열 뒤집기Computer Engineering/자료구조 2019. 9. 7. 22:03
- Java public static void reverse(char[] s, int index) { if(index==0) { return; }else { System.out.print(s[index-1]); reverse(s, index-1); } } public static void main(String[] args) { char[] s = {'h','e','l','l','o'}; reverse(s, s.length); } public static void reverse(char[] s, int f, int t) { if(f>t) { return; }else { reverse(s, f+1, t); System.out.print(s[f]); } } public static void main(Strin..