当前位置:网站首页>LeetCode 344. Reverse string
LeetCode 344. Reverse string
2022-07-01 09:13:00 【Ashby's daily life】
https://leetcode-cn.com/problems/reverse-string/
Ideas :
- Double pointer , Head pointer and tail pointer
- When the head pointer index is smaller than the tail pointer index , Exchange value
/** * Double pointer * @param s */
public void reverseString(char[] s) {
int first = 0;
int last = s.length - 1;
while (first < last) {
char tmp = s[first];
s[first] = s[last];
s[last] = tmp;
first++;
last--;
}
}
边栏推荐
- Flink面试题
- 易点易动助力企业设备高效管理,提升设备利用率
- Embedded Engineer Interview frequently asked questions
- 小鸟识别APP
- Promise asynchronous programming
- How to manage fixed assets efficiently in one stop?
- 2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder
- Niuke monthly race 22- collect pieces of paper
- 【pytorch学习】torch.device
- Shell script case in statement
猜你喜欢
随机推荐
易点易动助力企业设备高效管理,提升设备利用率
Shell script case in and regular expressions
pcl_viewer命令
Set the type of the input tag to number, and remove the up and down arrows
nacos簡易實現負載均衡
Shell script - string
LogBack
Pain points and solutions of equipment management in large factories
It technology ebook collection
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
Win7 pyinstaller reports an error DLL load failed while importing after packaging exe_ Socket: parameter error
Embedded Engineer Interview frequently asked questions
美团2022年机试
In the middle of the year, where should fixed asset management go?
Shell script case in statement
JCL and slf4j
Daily office consumables management solution
Shell脚本-数组定义以及获取数组元素
Graduation season, I want to tell you
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的WS2812灯控系统