Reverse String

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

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

 /*************************************************************************
> File Name: LeetCode344.c
> Author: Juntaran
> Mail: Jacinthmail@gmail.com
> Created Time: 2016年05月10日 星期二 02时25分37秒
************************************************************************/ /************************************************************************* Reverse String Write a function that takes a string as input and returns the string reversed. Example:
Given s = "hello", return "olleh". ************************************************************************/ #include "stdio.h" char* reverseString(char* s)
{
int i;
int length = strlen(s);
char temp; for( i=; i<length/; i++ )
{
temp = s[i];
s[i] = s[length-i-];
s[length-i-] = temp;
}
return s;
} int main()
{
char* s = "hello";
reverseString(s);
return ;
}

LeetCode 344的更多相关文章

  1. LeetCode 344. Reverse String(反转字符串)

    题目描述 LeetCode 344. 反转字符串 请编写一个函数,其功能是将输入的字符串反转过来. 示例 输入: s = "hello" 返回: "olleh" ...

  2. Leetcode 344:Reverse String 反转字符串(python、java)

    Leetcode 344:Reverse String 反转字符串 公众号:爱写bug Write a function that reverses a string. The input strin ...

  3. 前端与算法 leetcode 344. 反转字符串

    目录 # 前端与算法 leetcode 344. 反转字符串 题目描述 概要 提示 解析 解法一:双指针 解法二:递归 算法 传入测试用例的运行结果 执行结果 GitHub仓库 # 前端与算法 lee ...

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

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

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

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

  6. Leetcode#344. Reverse String(反转字符串)

    题目描述 编写一个函数,其作用是将输入的字符串反转过来. 示例 1: 输入: "hello" 输出: "olleh" 示例 2: 输入: "A man ...

  7. leetcode 344. Reverse String 、541. Reverse String II 、796. Rotate String

    344. Reverse String 最基础的旋转字符串 class Solution { public: void reverseString(vector<char>& s) ...

  8. Leetcode 344. 反转字符串

    344. Reverse String 解题代码: class Solution { public: void reverseString(vector<char>& s) { , ...

  9. Java实现 LeetCode 344 反转字符串

    344. 反转字符串 编写一个函数,其作用是将输入的字符串反转过来.输入字符串以字符数组 char[] 的形式给出. 不要给另外的数组分配额外的空间,你必须原地修改输入数组.使用 O(1) 的额外空间 ...

  10. LeetCode 344. Reverse String

    Problem: Write a function that takes a string as input and returns the string reversed. Example: Giv ...

随机推荐

  1. Base64编解码(C++版)

    #include <string> using namespace std; class ZBase64 { public:     /*编码     DataByte         [ ...

  2. free 和 fclose

    想到一个场景,具体代码如下 #include <stdio.h> #include <stdlib.h> int main(int argc, const char *argv ...

  3. STM32的GPIO使用的函数剖析

    转载http://blog.csdn.net/wuwuhuizheyisheng/article/details/8239599 STM32的GPIO总结 作者:JCY 该文是自己学习了一段STM32 ...

  4. iOS 8版本信息与屏幕尺寸

    原文  http://www.cnblogs.com/smileEvday/p/iOS8.html   1.UIWindow的bounds iOS 7之前Window的bounds不会随着方向而变化, ...

  5. AVCaptureDevice

    转载自:http://blog.csdn.net/andy_jiangbin/article/details/19820717   0.媒体采集的几个东西.这里所需要明白的是,在这个流程中,这里会存在 ...

  6. ajax。表单

    JQuery读书笔记--JQuery-Form中的ajaxForm和ajaxSubmit的区别JQuery中的ajaxForm和ajaxSubmit使用差不多功能也差不多.很容易误解. 按照作者的解释 ...

  7. EasyUI datetimebox设置默认值为当前时间

    设置value="${notices.release_time}" <input class="easyui-validatebox easyui-datetime ...

  8. python 实现冒泡排序与快速排序 遇到的错误与问题

    今天看了兄弟连php里面的冒泡排序与快速排序,想了下应该可以用python实现. 冒泡排序函数: def mysort(x): len1 = len(x) for i in range(len1-1, ...

  9. status pending状态

    开发采用ssh,注解的方式,事物也application.xml配置了,但是在业务层没有使用@Transactional造成浏览器一直处于status pending状态,为什么没有使用@Transa ...

  10. seajs 2.3.0 加入jquery

    [前言] 上篇文章简单的介绍了seajs的使用,下午使用seajs整合jquery就碰到问题了. 下载seajs上的examples,里面直接require('jquery')没有不论什么问题, 我照 ...