题目:

Write a function that takes a string as input and returns the string reversed.

Example:
Given s = "hello", return "olleh".

解答:这个题目超级无敌简单,就是把一个string给逆过来输出。

代码:

class Solution {
public:
    string reverseString(string s) {
        stringstream res;
        res.clear();
        for(int i = s.length() - 1;i >= 0;i--)
        {
            res << s[i];
        }
        return res.str();
    }
};

转载于:https://www.cnblogs.com/CodingGirl121/p/5421933.html

Leetcode题目:Reverse String相关推荐

  1. LeetCode之Reverse String II

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

  2. LeetCode之Reverse String

    1.题目: Write a function that takes a string as input and returns the string reversed. Example: Given ...

  3. LeetCode 541. Reverse String II

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

  4. LeetCode: 344. Reverse String

    051102 题目 Write a function that reverses a string. The input string is given as an array of characte ...

  5. LeetCode 344. Reverse String

    题目: Write a function that takes a string as input and returns the string reversed. Example: Given s ...

  6. LeetCode 344.Reverse String

    题意: Write a function that takes a string as input and returns the string reversed. Example: Given s ...

  7. leetcode 151 Reverse Words in a String (python)

    leetcode 151   Reverse Words in a String 题目描述: Given an input string, reverse the string word by wor ...

  8. leetcode 557. Reverse Words in a String III 、151. Reverse Words in a String

    557. Reverse Words in a String III 最简单的把空白之间的词反转 class Solution { public:string reverseWords(string ...

  9. 【跟Leon一起刷LeetCode】344. Reverse String

    Reverse String Description: Write a function that takes a string as input and returns the string rev ...

  10. LeetCode之Reverse Integer

    1.题目 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 cli ...

最新文章

  1. Jenkins的错误“error fetching remote repo origin”的问题解决
  2. 信息处理进入了计算机领域,信 息 处 理 进 入 了 计 算 机 领 域 ,实 质 是 进 入 了()的 领 域 。...
  3. Android开发之旅:android架构
  4. Python 爬起数据时 'gbk' codec can't encode character '\xa0' 的问题
  5. VisNetic MailServer 常见问题
  6. Vue — 第四天(components组件)
  7. 机器学习——深度学习之卷积神经网络(CNN)——LeNet卷积神经网络结构
  8. neo4j 查询同一节点的两个上级_WhatRoute for Mac(互联网流量诊断查询工具)
  9. iPhone X 刘海打理指北
  10. MySQL学习(5)数据库备份
  11. html5把六张图片做成立方体,HTML5绘制在立方体上的几何曲线图形
  12. Android 系统(207)---Android各种Drawable讲解和demo实例
  13. 网络监视工具nethogs命令
  14. CCF认证-2014-12-2 Z字形扫描
  15. linux下休眠/待机命令
  16. 时间序列-ARIMA模型调参检验实战
  17. 最长递增子序列(LIS longest-increment-subsequence)最长连续递增子序列 最大连续子序列和
  18. tomcat修改端口号失效
  19. Flink DataStream的wordCount、数据源和Sink、Side Outputs、两阶段提交(two-phase commit, 2PC)
  20. 我常用的网站资源集合

热门文章

  1. 利用物联网技术为市民打造“无忧”生活
  2. PHP 实现Session入库/存入redis
  3. nginx: [warn] conflicting server name localhost on 0.0.0.0:80, ignored
  4. mysql_connect 与 memcache_connect
  5. json数组对象和对象数组
  6. 使用axis2解析wsdl反向生成webservice客户端
  7. Struts2学习笔记(十六) 文件上传(File Upload)
  8. Java web(2012/2/23)
  9. 分布式系统最终一致性
  10. Spring中HibernateCallback的用法(转)