当前位置:网站首页>LeetCode Daily 2 Questions 01: Reverse Strings (both 1200) Method: Double Pointer
LeetCode Daily 2 Questions 01: Reverse Strings (both 1200) Method: Double Pointer
2022-08-10 22:29:00 【The man was fishing for snow in the cold river alone.】
The title is as follows:
Method:
Solution idea: Use the double pointer method to determine the left value left and the right value right of the array, and then exchange the two-digit numbers. After each cycle, the left is shifted to the right, and the right is shifted to the left,
class Solution {public void reverseString(char[] s) {int left=0,h=(s.length-1)/2,right=s.length-1;while (left<=h){//0<2char temp=s[left];s[left]=s[right];s[right]=temp;left++;right--;}}}
边栏推荐
- RADIUS Authentication Server Deployment Costs That Administrators Must Know
- 谁是边缘计算服务的采购者?是这六个关键角色
- 今日睡眠质量记录75分
- 论文解读(g-U-Nets)《Graph U-Nets》
- camera预览流程 --- 从HAL到OEM
- MySQL Advanced Commands
- Black cats take you learn Makefile article 13: a Makefile collection compile problem
- Application of Spatial 3D Model Reconstruction Based on Pix4Dmapper - Spatial Analysis and Site Selection
- 黑猫带你学Makefile第12篇:常见Makefile问题汇总
- 【开源教程5】疯壳·开源编队无人机-飞控固件烧写
猜你喜欢
GMT,UTC,CST,DST,RTC,NTP,SNTP,NITZ: 嵌入式的时间
Regular expression of shell programming and text processor
Translating scientific and technological papers, how to translate from Russian to Chinese
管理员必须知道的RADIUS认证服务器的部署成本
“数据引擎”开启前装规模量产新赛道,「智协慧同」崭露头角
从斐波那契 - 谈及动态规划 - 优化
BM13判断一个链表是否为回文结构
新一代网络安全防护体系的五个关键特征
xshell (sed command)
camera preview process --- from HAL to OEM
随机推荐
C # Hex file transfer skills necessary article 】 【 bin file code implementation
A shell script the for loop statements, while statement
Translating scientific and technological papers, how to translate from Russian to Chinese
ThreadLocal全面解析(一)
labelme-屏蔽拖拽的事件
Black cats take you learn Makefile article 13: a Makefile collection compile problem
STL-deque
配电网络扩展规划:考虑使用概率性能源生产和消费概况的决策(Matlab代码实现)
HighTec shortcut keys (Keys) setting location
Live Classroom System 08-Tencent Cloud Object Storage and Course Classification Management
shell编程之正则表达式与文本处理器
【Maui正式版】创建可跨平台的Maui程序,以及有关依赖注入、MVVM双向绑定的实现和演示
IM 即时通讯开发如何设计图片文件的服务端存储架构
LeetCode Daily Question (1573. Number of Ways to Split a String)
交换机和生成树知识点
阿里巴巴、蚂蚁集团推出分布式数据库 OceanBase 4.0,单机部署性能超 MySQL
黑猫带你学Makefile第11篇:当头文件a.h改变时,如何将所有依赖头文件a.h的.c文件都重新编译
These must-know JVM knowledge, I have sorted it out with a mind map
【PCBA方案设计】蓝牙跳绳方案
QT笔记——vs + qt 创建一个带界面的 dll 和 调用带界面的dll