标签:array return ring code new toc res ack cte
自己写法,不过不被leetcode接受,提示Time Limit Exceeded~~~
public String reverseString(String s) { String res = ""; Stack<Character> stack = new Stack<>(); char[] ch = s.toCharArray(); int count = 0; for(char c : ch) { count++; stack.push(c); } for(int i=0; i<count;i++) { res += stack.pop(); } return res; }
leetcode344 Reverse String Java
标签:array return ring code new toc res ack cte
原文地址:http://www.cnblogs.com/LoveBell/p/6432839.html