diff --git a/Python/Longest_Uncommon_Subsequence.py b/Python/Longest_Uncommon_Subsequence.py new file mode 100644 index 0000000..8943408 --- /dev/null +++ b/Python/Longest_Uncommon_Subsequence.py @@ -0,0 +1,18 @@ +#Link Of Question :https://leetcode.com/problems/longest-uncommon-subsequence-i/ +#134. Longest Uncommon Subsequence I +#Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If the longest uncommon subsequence does not exist, return -1 +#Solution : + +class Solution: + def findLUSlength(self, a: str, b: str) -> int: + if a!=b: + return max(len(a),len(b)) + return -1 + + + +#Sample Input 1 : a = "aaa", b = "bbb" +#Sample output 1 : 3 + +#Sample input 2 : a = "aaa", b = "aaa" +#Sample output 1 : -1 \ No newline at end of file diff --git a/Python/README.md b/Python/README.md index 2c30bfb..4b55b53 100644 --- a/Python/README.md +++ b/Python/README.md @@ -6,3 +6,4 @@ 2 : Missing Number
3 : Peak Element
7 : Reverse Integer
+521 : Longest Uncommon Subsequence I