LeetCode 58. Length of Last Word
来源:互联网 发布:二维傅里叶变换 矩阵 编辑:程序博客网 时间:2024/06/05 12:40
Given a string s consists of upper/lower-case alphabets and empty space characters ' '
, return the length of last word in the string.
If the last word does not exist, return 0.
Note: A word is defined as a character sequence consists of non-space characters only.
For example, Given s = "Hello World",return 5.
程序代码:
int lengthOfLastWord(char* s) { int count = 0; int i=strlen(s)-1; while(s[i]==' ') i--; while(s[i]!=' '&&i>=0) { count++; i--; } return count;}
0 0
- 58. Length of Last Word Leetcode Python
- [LeetCode]58.Length of Last Word
- LeetCode --- 58. Length of Last Word
- [Leetcode] 58. Length of Last Word
- [leetcode] 58.Length of Last Word
- LeetCode - 58. Length of Last Word
- <LeetCode OJ> 58. Length of Last Word
- 58. Length of Last Word LeetCode
- 【LeetCode】58. Length of Last Word
- leetcode 58. Length of Last Word
- LeetCode *** 58. Length of Last Word
- LeetCode 58. Length of Last Word
- leetcode-58. Length of Last Word
- LeetCode-58.Length of Last Word
- [leetcode] 58. Length of Last Word
- LeetCode 58. Length of Last Word
- Leetcode-58. Length of Last Word
- leetcode-java-58. Length of Last Word
- centos安装7zip
- Installation error: INSTALL_CANCELED_BY_USER
- 运动目标检测与跟踪常用算法
- java.lang.OutOfMemoryError: PermGen space及其解决方法
- 动态链接库(DLL)
- LeetCode 58. Length of Last Word
- Space Shooter项目中遇到的问题
- python day1(20170220)
- 【解决问题】windows下配置Boost提示'cl' 不是内部或外部命令,也不是可运行的程序 或批处理文件
- [Leetcode]153. Find Minimum in Rotated Sorted Array
- Sublime Text自定制代码片段(Code Snippets)
- 转换后缓冲器
- Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) E
- 2.20.1 绝对值排序