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

Meituan dynamic thread pool practice ideas, open source

What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method

The American Championship is about to start. Are you ready?

装饰器学习01

Three "factions" in the metauniverse

Recovery technology with checkpoints

Summary of concurrency control

Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程

Practice: fabric user certificate revocation operation process

Blocking of concurrency control
随机推荐
The difference between MVVM and MVC
Codeforces 12D ball tree array simulation 3 sorting elements
阿龙的感悟
Oracle advanced query
Sentinel production environment practice (I)
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
Oracle is sorted by creation time. If the creation time is empty, the record is placed last
Blocking of concurrency control
Regular expressions and re Libraries
元宇宙中的三大“派系”
Official clarification statement of Jihu company
Serializability of concurrent scheduling
Form artifact
boundary IoU 的计算方式
U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
Tips for using SecureCRT
Overview of database recovery
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
A substring with a length of three and different characters in the leetcode simple question
"Chris Richardson microservices series" uses API gateway to build microservices