当前位置:网站首页>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--;
}
}
边栏推荐
- delete和delete[]引发的问题
- 韦东山板子编译内核问题解决
- Shell script -read command: read data entered from the keyboard
- Key points of NFT supervision and overseas policies
- nacos服务配置和持久化配置
- Shell script - special variables: shell $, $*, [email protected], $$$
- 计网01-物理层
- 【pytorch】nn. AdaptiveMaxPool2d
- Niuke monthly race 22- collect pieces of paper
- [pytorch] softmax function
猜你喜欢

2.2 【pytorch】torchvision.transforms

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

nacos簡易實現負載均衡

钓鱼识别app

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

【pytorch】softmax函数

nacos简易实现负载均衡

Mise en œuvre simple de l'équilibrage de la charge par nacos

An overview of the design of royalties and service fees of mainstream NFT market platforms
![2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder](/img/19/cce8d8a7cdcb1021166c46adf803c1.png)
2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder
随机推荐
Ape anthropology topic 20 (the topic will be updated from time to time)
Common interview questions for embedded engineers 2-mcu_ STM32
微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
Pain points and solutions of fixed assets management of group companies
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的温湿度监控系统
Record a redis timeout
SDN_ Simple summary
Tree structure --- binary tree 1
2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data
MySQL optimization
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + MQ Series + nodejs local service + MySQL storage
Nacos service configuration and persistence configuration
How to launch circle of friends marketing and wechat group activities
队列的实现和应用
delete和delete[]引发的问题
I use flask to write the website "one"
Which method is good for the management of fixed assets of small and medium-sized enterprises?
In the middle of the year, where should fixed asset management go?
Shell脚本-变量的定义、赋值和删除
How to solve the problem of fixed assets management and inventory?