当前位置:网站首页>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--;
}
}
边栏推荐
- Promise异步编程
- Mise en œuvre simple de l'équilibrage de la charge par nacos
- 易点易动助力企业设备高效管理,提升设备利用率
- [ESP nanny level tutorial] crazy completion chapter - Case: temperature and humidity monitoring system based on Alibaba cloud, applet and Arduino
- The jar package embedded with SQLite database is deployed by changing directories on the same machine, and the newly added database records are gone
- Structure de l'arbre - - - arbre binaire 2 traversée non récursive
- Tree structure -- binary tree 2 non recursive traversal
- Serialization, listening, custom annotation
- [video game training] real topic of 2013 video game of infrared optical communication device
- SDN_ Simple summary
猜你喜欢

Installing Oracle EE

Nacos service configuration and persistence configuration

足球篮球体育比赛比分直播平台源码/app开发建设项目

2.4 activation function

2.2 【pytorch】torchvision.transforms

Preparing for the Blue Bridge Cup -- bit operation

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

3D printing Arduino four axis aircraft

Principle and application of single chip microcomputer timer, serial communication and interrupt system

计网01-物理层
随机推荐
Can diffusion models be regarded as an autoencoder?
2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
樹結構---二叉樹2非遞歸遍曆
Nacos service configuration and persistence configuration
3D打印Arduino 四轴飞行器
TV size and viewing distance
Shell script - array definition and getting array elements
Shell脚本-特殊变量:Shell $#、$*、[email protected]、$?、$$
Understand shallow replication and deep replication through code examples
【pytorch】nn. AdaptiveMaxPool2d
Shell脚本-while循环详解
足球篮球体育比赛比分直播平台源码/app开发建设项目
2.2 【pytorch】torchvision. transforms
LogBack
记一次redis超时
[ESP nanny level tutorial] crazy completion chapter - Case: temperature and humidity monitoring system based on Alibaba cloud, applet and Arduino
2.4 激活函数
R language observation log (part24) -- initialization settings
Set the type of the input tag to number, and remove the up and down arrows
Design and manufacture of simple digital display electronic scale