C++ Simple 9ms Solution O(n)

  • 0

    Simple 9ms C++ Solution: Get the length of the string, and append starting from the last character, onto a new string.

    class Solution {
        string reverseString(string s) {
            string r;
            int len = s.length();
            for (int i = 0; i < len; i++) {
            return r;

Log in to reply

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