[LeetCode 58]Length of Last Word
来源:互联网 发布:而知也无涯作者是谁 编辑:程序博客网 时间:2024/05/22 04:48
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
.
python 代码:
def length(x): val=''.join(x.split()) if val == '': return 0 else: return len(x.split()[-1])
0 0
- [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
- [Leetcode 58, easy] Length of Last Word
- Length of Last Word (leetCode 58)
- leetcode[58]:Length of Last Word
- 【leetcode c++】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(c)
- leetcode 58: Length of Last Word
- leetCode #58 Length of Last Word
- [ERROR] Terminal initialization failed; falling back to unsupported java.lang.IncompatibleClassChang
- IntelliJ打包可执行的Jar包
- 借助Clarifai的深度学习 电脑也能看懂视频了
- H5的简单标签
- android studio 学习(快捷键)
- [LeetCode 58]Length of Last Word
- Final变量 编译时期就确定具体值
- Service基础和利用Service进行跨进程通信
- Java ConcurrentModificationException异常原因和解决方法
- 今天在群里看到一道面试题,做了两种解法
- button的OnClickListener的三种实现方法
- HDU 4734F(x) 数位 dp
- java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log 造成的原因和解决方法
- Android开发必备技能之:Android中图片的三级缓存实现