Binary Tree Postorder Traversal (Python)
Valid Parentheses @ LeetCode (Python)

Length of Last Word (Python)

kitt posted @ 2014年2月13日 01:47 in LeetCode , 1905 阅读

 

class Solution:
    # @param s, a string
    # @return an integer
    def lengthOfLastWord(self, s):
        s_split = s.split()
        return 0 if len(s_split) == 0 else len(s_split[-1])

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter