leetcode-easy-string-344 Reverse String
mycode
class Solution(object):
def reverseString(self, s):
"""
:type s: List[str]
:rtype: None Do not return anything, modify s in-place instead.
"""
s = s.reverse()
参考:更快
class Solution(object):
def reverseString(self, s):
"""
:type s: List[str]
:rtype: None Do not return anything, modify s in-place instead.
"""
temp = ""
for i in range(len(s) / 2):
temp = s[i]
s[i] = s[len(s)-1-i]
s[len(s)-1-i] = temp
leetcode-easy-string-344 Reverse String的更多相关文章
- LeetCode Javascript实现 344. Reverse String 292. Nim Game 371. Sum of Two Integers
344. Reverse String /** * @param {string} s * @return {string} */ var reverseString = function(s) { ...
- [LeetCode] 344 Reverse String && 541 Reverse String II
原题地址: 344 Reverse String: https://leetcode.com/problems/reverse-string/description/ 541 Reverse Stri ...
- 344. Reverse String【easy】
344. Reverse String[easy] Write a function that takes a string as input and returns the string rever ...
- Leetcode#344. Reverse String(反转字符串)
题目描述 编写一个函数,其作用是将输入的字符串反转过来. 示例 1: 输入: "hello" 输出: "olleh" 示例 2: 输入: "A man ...
- leetcode 344. Reverse String 、541. Reverse String II 、796. Rotate String
344. Reverse String 最基础的旋转字符串 class Solution { public: void reverseString(vector<char>& s) ...
- 【leetcode】344. Reverse String
problem 344. Reverse String solution: class Solution { public: void reverseString(vector<char> ...
- 344. Reverse String(C++)
344. Reverse String Write a function that takes a string as input and returns the string reversed. E ...
- [LeetCode] 344. Reverse String 翻转字符串
Write a function that reverses a string. The input string is given as an array of characters char[]. ...
- Leetcode 344 Reverse String 字符串处理
题意:反转字符串,用好库函数. class Solution { public: string reverseString(string s) { reverse(s.begin(),s.end()) ...
- (字符串 数组 递归 双指针) leetcode 344. Reverse String
Write a function that reverses a string. The input string is given as an array of characters char[]. ...
随机推荐
- css折叠表格
1.html <div class="custom-fold-table"> <table cellpadding="0" cellspaci ...
- docker 网络 实现
最近在学习docker网络相关的知识,关于网络这块儿记下来,以便review dokcer安装完成之后默认提供三种网络 bridge host none docker默认使用bridge brid ...
- Ubuntu安装配置Tensorflow-GPU
Ubuntu 16.04 + GTX 1080 Ti + CUDA 9.0 + Cudnn 7.1 安装配置 1. 安装显卡驱动 首先查看一下自己的电脑需要怎样的驱动,我们可以先到 http://ww ...
- iscsi原理
iscsi原理 一,[名词解释] SCSI:小型计算机系统接口,SCSI作为i输入/输出接口, FC:光纤通道 DAS:直连式存储,指将存储设备通过SCSI接口或光纤通道直接连到一台计算机上. NAS ...
- 架构师成长之路5.3-Saltstack配置管理(State状态模块)
点击架构师成长之路 架构师成长之路5.3-Saltstack配置管理(State状态模块) 配置管理工具: Pupper:1. 采用ruby编程语言:2. 安装环境相对较复杂:3.不支持远程执行,需要 ...
- html 中 图片和文字一行 垂直居中对齐
效果: 代码:<div><img src='img/point_icon.png' width='35px' height='35px' style='float: lef ...
- Highcharts动态获取值
<script type="text/javascript"> $(document).ready(function (){ var o ...
- DEC-UPDATE
12/19-12/26 # -*- coding: utf-8 -*- import sys ans = [1,2,3,4,5,6] def operate(fun): a = ans[0] b = ...
- 三大方面,分析 to B和 to C产品的区别
作为互联网从业者,我们经常听到to B(或2B)和to C(或2C)两个概念.to B即面向企业客户,to C即面向普通用户.只要是互联网人基本都懂知道这两个概念,但如果别人再问“to B和to C产 ...
- DevExpress ASP.NET v19.1版本亮点:Pivot Grid等控件
行业领先的.NET界面控件DevExpress 发布了v19.1版本,本文将以系列文章的方式为大家介绍DevExpress ASP.NET Controls v19.1中新增的一些控件及增强的控件功能 ...