Java solution using StringBuffer


  • 0
    S
    class Solution {
        public String reverseString(String s) {
            if(s.length() == 0 ) return "";
            return  new StringBuffer(s).reverse().toString();
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.