当前位置:网站首页>344. Reverse String. Sol
344. Reverse String. Sol
2022-07-05 22:16:00 【isee_ nh】
Official handling sol, It feels good not to distinguish between odd and even
Write a function that reverses a string. The input string is given as an array of characters s
.
You must do this by modifying the input array in-place with O(1)
extra memory.
Example 1:
Input: s = ["h","e","l","l","o"] Output: ["o","l","l","e","h"]
Example 2:
Input: s = ["H","a","n","n","a","h"] Output: ["h","a","n","n","a","H"]
Constraints:
1 <= s.length <= 105
s[i]
is a printable ascii character.class Solution: def reverseString(self, s): left, right = 0, len(s) - 1 while left < right: s[left], s[right] = s[right], s[left] left, right = left + 1, right - 1
边栏推荐
- Business learning of mall order module
- Overview of database recovery
- How to view Apache log4j 2 remote code execution vulnerability?
- Oracle advanced query
- Two stage locking protocol for concurrency control
- Win11缺少dll文件怎么办?Win11系统找不到dll文件修复方法
- 科技云报道:算力网络,还需跨越几道坎?
- What changes has Web3 brought to the Internet?
- Cobaltstrike builds an intranet tunnel
- 微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
猜你喜欢
A trip to Suzhou during the Dragon Boat Festival holiday
Talking about MySQL index
数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖
Ad637 notes d'utilisation
Granularity of blocking of concurrency control
2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth
Matlab draws a cute fat doll
A substring with a length of three and different characters in the leetcode simple question
Win11缺少dll文件怎么办?Win11系统找不到dll文件修复方法
The simple problem of leetcode is to split a string into several groups of length K
随机推荐
Common interview questions of redis factory
Leetcode simple question: check whether each row and column contain all integers
如何开发引入小程序插件
Basic grammar of interview (Part 1)
Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程
微服务链路风险分析
Did you brush the real title of the blue bridge cup over the years? Come here and teach you to counter attack!
Business learning of mall order module
How to add new fields to mongodb with code (all)
Hcip day 16
The difference between MVVM and MVC
Stored procedures and stored functions
Livelocks and deadlocks of concurrency control
Summary of El and JSTL precautions
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
Calculation method of boundary IOU
A substring with a length of three and different characters in the leetcode simple question
HDU 4391 paint the wall segment tree (water
微服務鏈路風險分析