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) ...
随机推荐
- Digest [IAB_SRI_Online_Advertising_Effectiveness]
http://www.pwc.com/en_GX/gx/entertainment-media/pdf/IAB_SRI_Online_Advertising_Effectiveness_v3.pdf
- 在VS2012中采用C++中调用DLL中的函数 (4)
这两天因为需要用到VS2012来生成一个DLL代码,但是之前并没有用过DLL相关的内容,从昨天开始尝试调试DLL的文件调用,起初笔者在网络上找到了3片采用VSXXX版本进行调试的例子,相关的内容见本人 ...
- STL容器迭代器失效分析
连续内存序列容器(vector, string, deque) 对于连续内存序列STL容器,例如vector,string,deque,删除当前iterator会使得后面所有的iterator都失效, ...
- 关于<html>标签里的class= no-js
最近研究bootstrap的时候,发现了一个案例网站有一段 <html class="no-js"> 然后问了下度娘,找到了一篇大神的文章 里面对这个有很详细的解释: ...
- python发邮件遇到的端口号问题
在学习使用python发邮件的过程中, 遇到了一个问题:由于测试的时候使用的是QQ邮箱,要求必须使用SSL/TLS加密,所以有了下面的代码, from email.mime.text import M ...
- Linux设备驱动开发环境的搭建(转)
经过两周的摸索,终于对Linux设备驱动开发有了个初步的认识,下面对Linux设备驱动开发环境的搭建做个小结,以方便自己以后查询,同时也能给同道的初学者一点帮助. 刚接触Linux设备驱动时,初学者往 ...
- git gc
git gc 有时候当你运行一些git命令(比如git pull)的时候,会有如下提示: 1 2 Auto packing the repository for optimum performance ...
- SQL更新表的字段
Oracle: alter table CAPIAGENTLOG modify(clientcode nvarchar2()) SQL Server: alter table CAPIAGENTLOG ...
- 爱之初体验---编译加载内核模块hello
1. hello.c #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h ...
- css3内处理
1.插入文字:content属性: p:after{content:"内容"} p:before{content:"内容"} ...