当前位置:网站首页>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--;}}}
边栏推荐
- 美味石井饭菜
- 论文解读(g-U-Nets)《Graph U-Nets》
- 新一代网络安全防护体系的五个关键特征
- shell编程之免交互
- Service - DHCP principle and configuration
- labelme - block drag and drop events
- What are the concepts, purposes, processes, and testing methods of interface testing?
- 直播课堂系统08-腾讯云对象存储和课程分类管理
- Live Classroom System 08 Supplement - Tencent Cloud Object Storage and Course Classification Management
- 财务年报怎样翻译,为什么要选择专业翻译公司?
猜你喜欢

FPGA - Memory Resources of 7 Series FPGA Internal Structure -03- Built-in Error Correction Function

阿里云张新涛:支持沉浸式体验应用快速落地,阿里云云XR平台发布

《DevOps围炉夜话》- Pilot - CNCF开源DevOps项目DevStream简介 - feat. PMC成员胡涛

BM13判断一个链表是否为回文结构

【PCBA scheme design】Bluetooth skipping scheme

解码2022中国网安强星丨正向建、反向查,华为构建数字化时代的网络安全防线

Using SylixOS virtual serial port, serial port free implementation system

爬虫request.get()出现错误

H3C S5130 IRF做堆叠

C#【必备技能篇】Hex文件转bin文件的代码实现
随机推荐
直播课堂系统08-腾讯云对象存储和课程分类管理
String类的常用方法
Intelligent scheme design - intelligent rope skipping scheme
3598. 二叉树遍历(华中科技大学考研机试题)
STL-deque
Live Classroom System 08-Tencent Cloud Object Storage and Course Classification Management
GMT,UTC,CST,DST,RTC,NTP,SNTP,NITZ: 嵌入式的时间
阿里云架构师金云龙:基于云XR平台的视觉计算应用部署
Self-organization is a two-way journey between managers and members
What are the concepts, purposes, processes, and testing methods of interface testing?
Black cats take you learn Makefile article 13: a Makefile collection compile problem
美味的佳肴
阿里云新增三大高性能计算解决方案,助力生命科学行业快速发展
SDP
艺术与科技的狂欢,阿那亚2022砂之盒沉浸艺术季
ASCII、Unicode和UTF-8
Extended Chinese Remainder Theorem
IM 即时通讯开发如何设计图片文件的服务端存储架构
财务年报怎样翻译,为什么要选择专业翻译公司?
接口测试的概念、目的、流程、测试方法有哪些?