标签:技术 system while pac src new nbsp oid str
问题:
package com.example.demo; public class Test344 { public void reverseString(char[] s) { // 双指针 int left = 0; int right = s.length - 1; while (left < right) { char temp = s[left]; s[left] = s[right]; s[right] = temp; left++; right--; } } public static void main(String[] args) { Test344 t = new Test344(); char[] arr = {‘a‘, ‘b‘, ‘c‘}; t.reverseString(arr); for (char c : arr) { System.out.println(c); } } }
标签:技术 system while pac src new nbsp oid str
原文地址:https://www.cnblogs.com/nxzblogs/p/11271598.html