Leetcode 之Length of Last Word(37)
扫描每个WORD的长度并记录即可。
int lengthOfLast(const char *s)
{
//扫描统计每个word的长度
int len = ;
while (*s)
{
if (*s++ != ' ')//注意不管是否满足s都要++
len++;
else if (*s && *s != ' ')
len = ;
} return len;
}
Leetcode 之Length of Last Word(37)的更多相关文章
- leetcode 题解: Length of Last Word
leetcode: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', re ...
- [LeetCode] 58. Length of Last Word 求末尾单词的长度
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
- 【leetcode】Length of Last Word
题目简述 Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return ...
- Java for LeetCode 058 Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
- LeetCode 58. Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
- Java [Leetcode 58]Length of Last Word
题目描述: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return ...
- LeetCode(48)-Length of Last Word
题目: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return t ...
- [leetcode]58. Length of Last Word最后一个词的长度
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
- 【LeetCode】- Length of Last Word(最后一个单词的长度)
[ 问题: ] Given a string s consists of upper/lower-case alphabets and empty space characters ' ', retu ...
- [leetcode] 18. Length of Last Word
这个题目很简单,给一个字符串,然后返回最后一个单词的长度就行.题目如下: Given a string s consists of upper/lower-case alphabets and emp ...
随机推荐
- 【BZOJ5288】[HNOI2018]游戏(乱搞?)
[BZOJ5288][HNOI2018]游戏(乱搞?) 题面 BZOJ 洛谷 题面自己到洛谷上看把 题解 考场上乱搞拿到了\(90\)分,简直不敢相信. 回家把代码再交了一份直接就\(AC\)了??? ...
- BZOJ5321 & 洛谷4064 & LOJ2274:[JXOI2017]加法——题解
https://www.lydsy.com/JudgeOnline/problem.php?id=5321 https://www.luogu.org/problemnew/show/P4064 ht ...
- BZOJ3339:Rmq Problem & BZOJ3585 & 洛谷4137:mex——题解
前者:https://www.lydsy.com/JudgeOnline/problem.php?id=3339 后者: https://www.lydsy.com/JudgeOnline/probl ...
- SQL_MODE
一 声明 标红部分为重点了解 原文:https://segmentfault.com/a/1190000005936172 二 SQL_MODE参数值 官方手册专门有一节介绍 https://dev. ...
- windows内存映射文件
http://shushanyegui.duapp.com/?p=731 在描述内存映射文件之前 我们先来写一个系统通过I/O来读写磁盘文件的小程序 #include "stdafx.h&q ...
- PowerDesigner 技巧【1】
Name与Code同步的问题: PowerDesigner中,修改了某个字段的name,其code也跟着修改,这个问题很讨厌,因为一般来说,name是中文的,code是字段名. 解决方法如下: 1.选 ...
- HDU 5646
DZY Loves Partition Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Ot ...
- AIM Tech Round (Div. 2) A
A. Save Luke time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- swift的UIbutton
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, ...
- 大道至简第一章伪代码读后感o(╯□╰)o
import.java.io*; import class duhougan; public static void main(Striing arges[]){ system.out.println ...