Skip to content

Instantly share code, notes, and snippets.

@RP-3
Last active March 19, 2020 22:45
Show Gist options
  • Save RP-3/29b089182ff0089347c47071df2ad992 to your computer and use it in GitHub Desktop.
Save RP-3/29b089182ff0089347c47071df2ad992 to your computer and use it in GitHub Desktop.
# First solution
class Solution:
def findLUSlength(self, a: str, b: str) -> int:
if len(a) != len(b):
return len(a) if len(a) > len(b) else len(b)
if a != b: return len(a)
return None
# simplified
class Solution:
def findLUSlength(self, a: str, b: str) -> int:
if a == b: return -1
return len(a) if len(a) > len(b) else len(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment