Wrong test case?


  • 0
    Z

    here is my code:

    class Solution:
        # @param {string} s
        # @return {integer}
        def lengthOfLongestSubstring(self, s):
            self.s = s
            k = []
            for i in range(len(s)):
                if s[i] not in k:
                    k.append(s[i])
            f = len(k)
    
            return(f)
    

    the system uses "pwwkew" as an input, the output should be 4, you can count it manually, but the system indicates:
    output: 4, expected: 3.

    Can anyone tell me what's wrong?


  • 0
    W

    I had the same question at first.
    Actually the question is asking the length of longest substring, not the number of char.


Log in to reply
 

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