Recursion Problem reverse String [Time Limit Exceeded] Swift

Hi i tried to solve "Reverse String" problem with recursion,
but it gives me every time time limit exceeded can anyone help me with this,
it fails at the last testcase, Thanks for advance.
Here is my code:

class Solution {
    func reverseString(_ s: inout [Character]) {
        if s.count == 0{ return  }
        let c = s.popLast()!
        reverseString(&s)
        s =  [c] + s
    }
}
Comments (1)