Reverse String Java Solution


  • 0
    J

    By utilizing the Java StringBuilder class, the code can be concise and written in 2 lines of code.

    class Solution {
        public String reverseString(String s) {
            StringBuilder value = new StringBuilder(s);
            return value.reverse().toString();
        }
    }
    

Log in to reply
 

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