当前位置:网站首页>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--;
}
}
边栏推荐
- Ranking list of domestic databases in February, 2022: oceanbase regained the "three consecutive increases", and gaussdb is expected to achieve the largest increase this month
- 【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
- Shell脚本-数组定义以及获取数组元素
- Shell script - array definition and getting array elements
- [ESP nanny level tutorial] crazy completion chapter - Case: chemical environment system detection based on Alibaba cloud and Arduino, supporting nail robot alarm
- The fixed assets management system enables enterprises to dynamically master assets
- Structure de l'arbre - - - arbre binaire 2 traversée non récursive
- dsPIC30F6014a LCD 方块显示
- [ESP nanny level tutorial] crazy completion chapter - Case: gy906 infrared temperature measurement access card swiping system based on the Internet of things
- pcl_ Viewer command
猜你喜欢

Simple load balancing with Nacos

Redis -- lattice connects to redis cluster

How to launch circle of friends marketing and wechat group activities

【电赛训练】红外光通信装置 2013年电赛真题

Reproduced Xray - cve-2017-7921 (unauthorized access by Hikvision)

NiO zero copy

Mysql 优化

Design and manufacture of simple digital display electronic scale

Pain points and solutions of equipment management in large factories

钓鱼识别app
随机推荐
2.2 【pytorch】torchvision.transforms
Latex插入的eps图片模糊解决方法
3D printing Arduino four axis aircraft
phpexcel 里 获取某一列的列表 获取某一列的字母
樹結構---二叉樹2非遞歸遍曆
Day06 branch structure and cycle (III)
Leetcode daily question brushing record --540 A single element in an ordered array
Flink面试题
Set the type of the input tag to number, and remove the up and down arrows
Phishing identification app
Redis——Lettuce连接redis集群
Shell script -read command: read data entered from the keyboard
Mysql8.0 learning record 17 -create table
足球篮球体育比赛比分直播平台源码/app开发建设项目
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DS18B20 temperature sensor +nodejs local service + MySQL database
TV size and viewing distance
R language observation log (part24) -- initialization settings
Shell脚本-read命令:读取从键盘输入的数据
Nacos service configuration and persistence configuration
Jeecg restart alarm 40001