Clean c# solution


  • 0
    X

    public class Solution {
    public string ReverseString(string s) {

        if (s == null || s.Length <=0)
        {
            return s;
        }
        
        int length = s.Length;
        
        StringBuilder resultBuilder = new StringBuilder();
        
        for(int i=length -1; i>=0; i--)
        {
            resultBuilder.Append(s[i]);
        }
        
        return resultBuilder.ToString();
    }
    

    }


Log in to reply
 

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