package point;/**题目:反转字符串,要求不修改原来的字符串* y: a b c d e e d c b a* @Author Gavin* @date 2022年01月10日 22:13*/public class solution_2 {public String solution(String s){if(s==null)return null;char[] c=s.toCharArray();for(int i=0,j=c.length-1;i<j;++i,--j){char tmp=c[i];c[i]=c[j];c[j]=tmp;}return new String(c);}public static void main(String[] args) {String s="abc";char[] chars = s.toCharArray();System.out.println(chars);}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。