当前位置:网站首页>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--;
}
}
边栏推荐
- Jeecg restart alarm 40001
- Daily practice of C language - day 80: currency change
- Jetson nano installs tensorflow GPU and problem solving
- 【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
- Shell script case in and regular expressions
- Football and basketball game score live broadcast platform source code /app development and construction project
- Reproduced Xray - cve-2017-7921 (unauthorized access by Hikvision)
- Principles of Microcomputer - Introduction
- Shell脚本-case in 和正则表达式
- Simple load balancing with Nacos
猜你喜欢

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

2.2 【pytorch】torchvision. transforms

Redis -- lattice connects to redis cluster

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

Imitation of Baidu search results top navigation bar effect

Pain points and solutions of fixed assets management of group companies

How to realize the usage of connecting multiple databases in idel

Pain points and solutions of equipment management in large factories

Bird recognition app

TV size and viewing distance
随机推荐
Shell脚本-while循环详解
Principles of Microcomputer - Introduction
3D printing Arduino four axis aircraft
Key points of NFT supervision and overseas policies
Shell script - definition, assignment and deletion of variables
OSPF - virtual link details (including configuration commands)
【pytorch】nn.AdaptiveMaxPool2d
Jetson nano installs tensorflow GPU and problem solving
韦东山板子编译内核问题解决
Pain points and solutions of fixed assets management of group companies
Simple load balancing with Nacos
Leetcode daily question brushing record --540 A single element in an ordered array
2.4 激活函数
Shell script case in and regular expressions
Promise异步编程
树结构---二叉树1
[pytorch] 2.4 convolution function nn conv2d
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的WS2812灯控系统
Meituan machine test in 2022
Installation and use of NoSQL database