Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 260 Bytes

ReverseStringSolution.md

File metadata and controls

13 lines (11 loc) · 260 Bytes

Reverse String Solution

Swift

func reverse(str: String) -> String {
    var reversedStr = ""
    for i in 0..<str.count {
        reversedStr.append(str[str.index(str.startIndex, offsetBy: str.count - 1 - i)])
    }
    return reversedStr
}