[leetcode]Length of Last Word
来源:互联网 发布:网络电视盒子推荐 编辑:程序博客网 时间:2024/05/06 20:27
class Solution {public: int lengthOfLastWord(const char *s) { // Start typing your C/C++ solution below // DO NOT write int main() function int N = 0; const char *p = s; while(*p){ p++; N++; } int i = N-1; while(i >= 0 && s[i] == ' '){ i--; } if(i == -1) return 0; int end = i; while(i >= 0 && s[i] != ' '){ i--; } int start = i; return end-start; }};
- LeetCode: Length of Last Word
- LeetCode Length of Last Word
- LeetCode : Length of Last Word
- [Leetcode] Length of Last Word
- [LeetCode] Length of Last Word
- [LeetCode]Length of Last Word
- [leetcode]Length of Last Word
- Leetcode:Length of Last Word
- LeetCode-Length of Last Word
- [LeetCode] Length of Last Word
- [leetcode] Length of Last Word
- leetcode length of last word
- LeetCode - Length of Last Word
- leetcode:Length of Last Word
- LeetCode:Length of Last Word
- LeetCode | Length of Last Word
- LeetCode - Length of Last Word
- Leetcode: Length of Last Word
- poj1741——树上的分治,树dp
- 秒表编译出错问题
- 头文件如何来关联源文件?
- CSS中DIV定位
- webform Url重写
- [leetcode]Length of Last Word
- VS2010下对话框添加菜单栏和工具栏及其启用,禁用同步
- [每日一题] OCP1z0-047 :2013-07-30 表连接――内联视图当作表使用....................................19
- 1.2
- 32位Xp安装vs2008错误, 找不到windows.h, 解决办法
- 阶乘的和
- NetworkX学习笔记-5-NetworkX中怎样对多个网络赋属性,并根据属性排序
- EJB3事务的使用
- 不同平台上Cocos2d-x所支持的最大纹理大小