[Solved] How to reverse string using recursive? [closed]


If you want to use recursive method why use loop in it…?

I have write simple method which returns the reverse string using recursion.

public string ReverseString(string s)
    {
        if (s == null || s.Length <= 1)  // if length is less or equal 1 then also returns
            return s;

        return ReverseString(s.Substring(1)) + s[0];
    }

Output Example Attached:
enter image description here

2

solved How to reverse string using recursive? [closed]