Last active
May 14, 2020 09:52
-
-
Save ftamhar/70e2ca62dc78e88d1fba059528ee6bb7 to your computer and use it in GitHub Desktop.
Lombok.py #SolutionCase1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def lengthOfLongestSubstring(self, strings): | |
| self.strings = strings | |
| self.panjangs = [0] | |
| self.sudah = [] | |
| for char in self.strings: | |
| if char not in self.sudah: | |
| self.sudah.append(char) | |
| self.panjangs[len(self.panjangs)-1] += 1 | |
| else: | |
| self.sudah = [] | |
| self.panjangs.append(0) | |
| return max(self.panjangs) | |
| print(Solution().lengthOfLongestSubstring('abrkaabcdefgahijjxxx')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment