why my code doesn't work with problem "Line 28: Exception: Type <type 'type'>: Not implemented"


  • -1
    L

    Why my code doesn't work?
    Please help me:

    '''
    class Solution(object):
    def reverseWords(self, s):
    """
    :type s: str
    :rtype: str
    """
    if not s or len(s) == 0:
    return str

        list = s.split(' ')
        ans = []
        
        for i in range(len(list)-1, -1, -1):
            if list[i] != ' ':
                ans.append(list[i])
        
        return " ".join(ans)
    

    '''

    Thanks


Log in to reply
 

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