RE: How to reverse String using java - learn java

You are viewing a single comment's thread from:

How to reverse String using java - learn java

in programming •  7 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
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!