Reverse String
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
char* reverseString(char* s) {
int i;
int j;
char temp;
i = ;
j = strlen(s) - ;
while(i < j){
temp = s[i];
s[i] = s[j];
s[j] = temp;
i++;
j--;
}
return s;
}
Reverse String的更多相关文章
- [LeetCode] Reverse String 翻转字符串
Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...
- LeetCode Reverse String
原题链接在这里:https://leetcode.com/problems/reverse-string/ 题目: Write a function that takes a string as in ...
- Nim Game,Reverse String,Sum of Two Integers
下面是今天写的几道题: 292. Nim Game You are playing the following Nim Game with your friend: There is a heap o ...
- [CareerCup] 1.2 Reverse String 翻转字符串
1.2 Implement a function void reverse(char *str) in C or C++ which reverses a null-terminated string ...
- 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 && 541 Reverse String II
原题地址: 344 Reverse String: https://leetcode.com/problems/reverse-string/description/ 541 Reverse Stri ...
- [LeetCode] Reverse String II 翻转字符串之二
Given a string and an integer k, you need to reverse the first k characters for every 2k characters ...
- 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(反转字符串)
题目描述 编写一个函数,其作用是将输入的字符串反转过来. 示例 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) ...
随机推荐
- 洛谷P1827 美国血统 American Heritage
P1827 美国血统 American Heritage 54通过 90提交 题目提供者JOHNKRAM 标签USACO 难度普及- 提交 讨论 题解 最新讨论 暂时没有讨论 题目描述 农夫约翰非 ...
- noip2009 潜伏者
P1071 潜伏者 827通过 2.2K提交 题目提供者洛谷OnlineJudge 标签字符串模拟2009NOIp提高组 难度普及/提高- 提交该题 讨论 题解 记录 题目描述 R 国和 S 国正 ...
- 详解YUV与RGB数据格式-2016.01.20
参考文献 什么是I帧,P帧,B帧 图文详解YUV420数据格式 RGB565 与 RGB888的相互转换 最简单的基于FFmpeg的libswscale的示例(YUV转RGB)
- 关于Java中形参与实参的理解
今天阅读了一个写的非常棒的博文,通过此博文再次复习了Java中参数传递的知识(即值传递与引用传递的区别).参考网站http://www.cnblogs.com/binyue/p/3862276.htm ...
- JS常用的设计模式(14)—— 备忘录模式
备忘录模式在js中经常用于数据缓存. 比如一个分页控件, 从服务器获得某一页的数据后可以存入缓存.以后再翻回这一页的时候,可以直接使用缓存里的数据而无需再次请求服务器. 实现比较简单,伪代码: var ...
- c++ boost--------------boost::progress_timer小试。
//--------------------------------------------------------------------------- #include <vcl.h> ...
- 利用SecondaryNameNode文件恢复Namenode-实践可行
二. namenode故障恢复(importCheckpoint) *注意事项: (1) 为了便于将随便一台datanode临时用作namenode,datanode和namenode配置需要一模一样 ...
- shp地图解析(不用AE)
AE太重型,还收费,如果只是加载地图作为底图,可以用纯C#实现.线类型用得最多,以下是线类型的数据结构: 总体架构 文件头 记录头 记录内容 记录头 记录内容 ............ 记录头 记录内 ...
- 必须会的SQL语句(六)查询
1.基础的查询 1)重命名列 select name as '姓名' from 表名 2)定义常量列 select 是否 ='是' from 表名 3) ...
- 解决Linux中遇到No such device
虚拟机备份转移后,网络启动异常,提示“SIOCSIFADDR: No such device” he problem lies in the fact that ethernet MAC addres ...