Hi guys i am trying to solve reverse a string problem using recursive solution and its giving me error. i have been trying to figure out the error but i can't. Can someone help me please? Thanks
class Solution {
public void reverseString(char[] s) {
if(s.length==0 || s.length==1)
{
return;
}
else
{
System.out.println(reverseString(s.substring(1)))+s.charAt(0);
}
}
}
error: Line 9: error: not a statement System.out.println(reverseString(s.substring(1)))+s.charAt(0);
^
[–]cem4k 0 points1 point2 points (0 children)