You are viewing a single comment's thread from:

RE: How to reverse String using java - learn java

in #programming7 years ago

Cool idea -- this is a super common interview question. Here's my own implementation in Python.

def reverse_string(string): 
    length = len(string)
    new_string = "" 
    for i in range(length): 
        new_string = new_string + string[length-i-1]
    return new_string