2 line python solution, doing better than 92% of solution


  • 0
    V

    '''
    class Solution(object):
    def lengthOfLastWord(self, s):
    try: return len(s.split()[-1])
    except: return 0
    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.