@Test
public void reversetes(){
String s=“1234”;
System.out.println(reverseTestSix(s));
System.out.println(“sdfsd”);
}
//切割递归反转
public static String reverseTestSix(String s) {
if (s.length() <= 1) {
return s;
}
String aa=“sd”;
String ddd = s.substring(0, 1);
String s1 = aa != null ? (reverseTestSix(s.substring(1)) + s.substring(0, 1)) : null;
return s1;
}
切割递归反转
最新推荐文章于 2024-08-23 15:54:50 发布