58. Length of Last Word
来源:互联网 发布:盒子设计软件绿色版 编辑:程序博客网 时间:2024/06/17 19:47
简单得不得简单 不说了
class Solution {public: int lengthOfLastWord(string s) { int n = s.length(); if(n == 0) return 0; int i; int sum = 0; for(i = n - 1; s[i] == ' ' && i >= 0; -- i); for(;s[i] != ' ' && i >= 0; -- i) sum++; return sum; }};
0 0
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58. Length of Last Word
- 58.Length of Last Word
- Light OJ 1282 Leading and Trailing (对数+快速幂)
- I AM ARRIVAL, I AM COMING.
- 55. Jump Game
- 56. Merge Intervals
- 57. Insert Interval
- 58. Length of Last Word
- hdu 1709 The Balance(母函数)
- 59. Spiral Matrix II
- 60. Permutation Sequence
- 目录的层级结构
- POJ 3258 River Hopscotch(二分)
- CodeForces 761C 【DP】
- codeforces-678-C. Joty and Chocolate(数学)
- js分页