question:

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

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

answer:

交换字符串中的元素

class Solution {
public:string reverseString(string s) {int l = s.length();int i;char tem;for(i=0;i<l/2;i++){tem = s[i];s[i] = s[l-1-i];s[l-1-i] = tem;}return s;}
};

转载于:https://www.cnblogs.com/Reindeer/p/5624687.html

344.Reverse String相关推荐

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

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

  2. String | 344. Reverse String

    题目:反转字符串 方法1: class Solution { public:string reverseString(string s) {int m = (s.size() -1) / 2;for( ...

  3. LeetCode 344.Reverse String

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

  4. LeetCode: 344. Reverse String

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

  5. Leet Code OJ 344. Reverse String [Difficulty: Easy]

    题目: 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. 344. Reverse String

  8. LeetCode344. Reverse String

    344. Reverse String My Submissions QuestionEditorial Solution Total Accepted: 6975 Total Submissions ...

  9. stone/reverse/string/digit(完美消除)

    stone/reverse/string/digit(完美消除) stone: [问题描述] 平平去海边度假,海边有一片美丽的鹅卵石滩.平平在鹅卵石滩上捡了 $n$ 块美丽的 鹅卵石,并把它们排成一个 ...

最新文章

  1. IntelliJ IDEA中用快捷键自动创建测试类
  2. Linux使用expect自动登录,linux中使用expect实现自动登录(示例代码)
  3. 页面 table 可编辑的实现
  4. siteMap与站点导航
  5. pipfile和pipfile.lock、virtualenv、pipenv、pip
  6. docker安装教程(windows和linux[centos8])
  7. TensorFlow-CIFAR10 CNN代码分析
  8. XtraGrid RepositoryItemCheckEdit 显示状态以及单选多选问题
  9. ❤️大佬都在学什么?Python爬虫分析C站大佬收藏夹,跟着大佬一起学, 你就是下一个大佬❤️!
  10. 计算机设计类有哪些专业,2021新高考模式下报考,这4类专业有“潜规则”,考生报考需谨慎...
  11. 运行vue遇到的坑(续更
  12. bat代码雨代码流星_怎么制作无限弹窗效果? 限弹窗代码bat文件分享
  13. z17刷miui_努比亚Z17刷机包
  14. 毕业生登记表特长填写计算机,大学生毕业登记表中有何特长该怎么填啊。
  15. 基于java的教师教学评价管理系统
  16. 如何设置,QQ邮箱新版界面
  17. RSA 中根据 (N, e, d) 求 (p, q)
  18. MySQL 文件结构、逻辑架构及 sql 执行流程分析作者:Java后端架构
  19. 华中科技大学计算机上机,华中科技大学计算机学院上机复试题目
  20. 高德地图打点获取点的坐标和名称

热门文章

  1. 常喝酒的人,为什么会出现手抖的现象?
  2. 有人说“如今聪明的年轻人上班,愚蠢的年轻人创业!”对此大家怎么看?
  3. 你经历过最奇特的梦境是怎样的?
  4. 整个线上营销_而言,最重要的是什么?
  5. 有一项调查显示:创业成功的年龄一般是在43岁左右
  6. 你真的会发朋友圈吗?
  7. 目前还有机会火的6大短视频内容方向
  8. 各年龄段都是怎么提加薪的?
  9. intellisense_SQL Server IntelliSense的使用和故障排除–适用于SQL Server 2012或更高版本
  10. 一台电脑,内外网同时使用