Unverified Commit c6e83186 authored by Lokesh Singh's avatar Lokesh Singh Committed by GitHub

Create Reverse string

parent 1087cdbc
class Reverse
{
// Complete the function
// str: input string
public static String reverseWord(String str)
{
// Reverse the string str
int n = str.length();
char ch[] = str.toCharArray();
for(int i = 0; i<n/2; i++)
{
char t = ch[i];
ch[i] = ch[n-i-1];
ch[n-i-1]=t;
}
return new String(ch);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment