From 82f9da4b50ebb8cfc66a188107a8b03e39d16d06 Mon Sep 17 00:00:00 2001 From: Sahil ahmed <78746946+sahilahmed24@users.noreply.github.com> Date: Mon, 4 Oct 2021 18:33:48 +0530 Subject: [PATCH 1/2] Resolved Issue #134 Longest Uncommon Subsequence I --- Python/Longest_Uncommon_Subsequence.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Python/Longest_Uncommon_Subsequence.py 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 From 5db30198d30d7c1e2108eb36c0c91d6b734feffe Mon Sep 17 00:00:00 2001 From: Sahil ahmed <78746946+sahilahmed24@users.noreply.github.com> Date: Mon, 4 Oct 2021 20:03:35 +0530 Subject: [PATCH 2/2] Update list for issue #134 --- Python/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/README.md b/Python/README.md index 56bbd96..21855e9 100644 --- a/Python/README.md +++ b/Python/README.md @@ -2,4 +2,5 @@ (If you are contributing your code in this language, don't forget to include it in the list below)
### NOTE : Include the code in the list in order of leetcode problem statement number -1 : Two Sum
\ No newline at end of file +1 : Two Sum
+521 : Longest Uncommon Subsequence I