当前位置:网站首页>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--;
}
}
边栏推荐
猜你喜欢

2.2 【pytorch】torchvision. transforms

Jeecg restart alarm 40001

How to manage fixed assets efficiently in one stop?

dsPIC30F6014a LCD 方块显示

Simple load balancing with Nacos

nacos简易实现负载均衡

How to realize the usage of connecting multiple databases in idel

Which method is good for the management of fixed assets of small and medium-sized enterprises?

小鸟识别APP

Reproduced Xray - cve-2017-7921 (unauthorized access by Hikvision)
随机推荐
Redis source code learning (29), compressed list learning, ziplist C (II)
Youqitong PE toolbox [vip] v3.7.2022.0106 official January 22 Edition
Embedded Engineer Interview frequently asked questions
Tree structure -- binary tree 2 non recursive traversal
【pytorch】2.4 卷积函数 nn.conv2d
Which method is good for the management of fixed assets of small and medium-sized enterprises?
【pytorch】nn.CrossEntropyLoss() 与 nn.NLLLoss()
Shell script - string
An overview of the design of royalties and service fees of mainstream NFT market platforms
laravel postman 提交表单出现419错误。2020年7月6日记。
【检测技术课案】简易数显电子秤的设计与制作
Databinding source code analysis
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
Serialization, listening, custom annotation
MySQL optimization
Promise异步编程
R language observation log (part24) -- initialization settings
Principles of Microcomputer - Introduction
Daily practice of C language - day 80: currency change
SDN_ Simple summary