<LeetCode><Easy> 58 Length of Last Word
来源:互联网 发布:淘宝上李选民书法真吗 编辑:程序博客网 时间:2024/03/28 22:06
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
.
#Python2 40ms
class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ if not s:return 0 s=s.split() return len(s[-1]) if len(s) else 0
0 0
- [Leetcode 58, easy] Length of Last Word
- 【LeetCode】(58)Length of Last Word(Easy)
- <LeetCode><Easy> 58 Length of Last Word
- LeetCode-58-Length of Last Word(字符串)-Easy
- leetcode 058 Length of Last Word(难易度:Easy)
- Leetcode 58. Length of Last Word (Easy) (cpp)
- 58.leetcode Length of Last Word(easy)[字符串 分割]
- leetcode 58. Length of Last Word(easy)
- LeetCode-Easy刷题(12) Length of Last Word
- [leetcode 58] Length of Last Word
- leetcode-58 Length of Last Word
- Leetcode NO.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
- Length of Last Word (leetCode 58)
- leetcode[58]:Length of Last Word
- 编辑距离问题
- 剑指offer.14:调整数组顺序使奇数位于偶数前面
- request对象和response对象
- Win32+OpenGL计算机图形学光照阴影算法 可控制光源、光照物等位置的移动以及漫游等
- java多线程学习笔记(八) ——线程停止(interrupt)
- <LeetCode><Easy> 58 Length of Last Word
- Guid
- 1025. 反转链表 (25)
- Request和Response详解
- Android上下文-Context
- 符号扩展(sign extension)的证明
- java多线程学习(九)——wait 和 sleep 区别、join用法
- c++ 流文件读写操作
- 调试libstdc++内部的函数