思路:在原来的字符串后面添加上strlen-1个字符,返回

class Solution {
public:
    string reverseString(string s) {
        unsigned int strlen;
        int i;
        // char temp;  

        strlen = s.size();
        ) {
            ; i >=  ; i--)   {
                // temp = s[i];
                s += s[i];
            }
             , strlen + strlen - );
        }
        else
            return s;
    }
}; 

reverse string | leetcode的更多相关文章

  1. [LeetCode] Reverse String 翻转字符串

    Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...

  2. LeetCode Reverse String

    原题链接在这里:https://leetcode.com/problems/reverse-string/ 题目: Write a function that takes a string as in ...

  3. [LeetCode] 344 Reverse String && 541 Reverse String II

    原题地址: 344 Reverse String: https://leetcode.com/problems/reverse-string/description/ 541 Reverse Stri ...

  4. [LeetCode] Reverse String II 翻转字符串之二

    Given a string and an integer k, you need to reverse the first k characters for every 2k characters ...

  5. 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) { ...

  6. LeetCode——Reverse String

    LeetCode--Reverse String Question Write a function that takes a string as input and returns the stri ...

  7. LeetCode Reverse String II

    原题链接在这里:https://leetcode.com/problems/reverse-string-ii/#/description 题目: Given a string and an inte ...

  8. LeetCode 541. Reverse String II (反转字符串 II)

    Given a string and an integer k, you need to reverse the first k characters for every 2k characters ...

  9. [LeetCode] 344. Reverse String 翻转字符串

    Write a function that reverses a string. The input string is given as an array of characters char[]. ...

随机推荐

  1. poj 2081 Recaman's Sequence

    開始还以为暴力做不出来,须要找规律,找了半天找不出来.原来直接暴力.. 代码例如以下: #include<stdio.h> int a[1000050]; int b[100000000] ...

  2. 初步掌握HBase

    1.HBase概述 HBase是hadoop生态系统中的重要组成部分,是一个开源的.面向列.适合存储海量非结构化数据或半结构化数据,具备高可靠性.高性能.可灵活扩展伸缩.支持实时数据读写的分布式存储系 ...

  3. 【转】iOS应用崩溃日志揭秘

    这篇文章还可以在这里找到 英语 If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter ...

  4. Unity Panel open & close

    Making a Popup and Closable Panel in Unity 5 script: public GameObject thePanel; public open() { the ...

  5. Java基础知识强化之IO流笔记30:字节流4种方式复制mp4并测试效率

    1. 需求:把e:\\哥有老婆.mp4 复制到当前项目目录下的copy.mp4中 字节流四种方式复制文件: • 基本字节流一次读写一个字节 • 基本字节流一次读写一个字节数组 • 高效字节流一次读写一 ...

  6. CentOS 6.7配置Nginx 1.8负载均衡

    本教程使用Vultr的VPS搭建,准备三台VPS,一主两从 master - 45.32.90.100 slave1 - 45.32.92.47 slave2 - 45.32.89.205 1.编译安 ...

  7. Genymotion无法启动Virtual Box

    Genymotion是非常快速的Android模拟器.这两天搞了一下Android Studio,想用Genymotion跑起一下,但死活都启动不了.很奇怪,明明几个月前还顺利启动的. Genymot ...

  8. 【Oracle】INSERT INTO SELECT语句和SELECT INTO FROM语句的区别

    >>>>>>>>>>>>>>>>>>>>>>>>> ...

  9. CSS权威指南-第三版--读书笔记

    第一章:CSS和文档 html是结构化语言,css是样式语言,html主要用来被强大的搜索引擎更好的索引,更好的让一个盲人通过语音浏览器来了解我们的网页,这也就是为什么说html是结构话语言,因为这是 ...

  10. Log4net 集成到MVC+EF框架

    前提引用Log4Net.dll文件 1. [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", ...