Reverse given string.

 Reverse given string.


Description:- 

This program reverse this given string.


Code:-


public class Solution {
    public String reversString(String A) {
        char[] arr = A.toCharArray();

        String ans="";
        int len = arr.length;

        for(int i=len-1;i>=0;i--){

           ans+=arr[i];
           
        }
        return ans;
    }
}



Feedback: - 

After reading this page if you have any feedback do let me know in comments; i will try to bring those things in my upcoming posts.

Comments

Popular Posts