Skip to content

Commit 68aacea

Browse files
solves longest uncommon subsequence
1 parent 4f58316 commit 68aacea

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
| 507 | [Perfect Number](https://leetcode.com/problems/perfect-number) | Easy | [![Java](assets/java.png)](src/CheckPerfectNumber.java) [![Python](assets/python.png)](python/check_perfect_number.py) |
139139
| 509 | [Fibonacci Number](https://leetcode.com/problems/fibonacci-number) | Easy | [![Java](assets/java.png)](src/FibonacciNumber.java) [![Python](assets/python.png)](python/fibonacci_number.py) |
140140
| 520 | [Detect Capital](https://leetcode.com/problems/detect-capital) | Easy | [![Java](assets/java.png)](src/DetectCapital.java) [![Python](assets/python.png)](python/detect_capital.py) |
141-
| 521 | [Longest Uncommon Subsequence I](https://leetcode.com/problems/longest-uncommon-subsequence-i) | Easy | |
141+
| 521 | [Longest Uncommon Subsequence I](https://leetcode.com/problems/longest-uncommon-subsequence-i) | Easy | [![Java](assets/java.png)](src/LongestUncommonSubsequenceI.java) [![Python](assets/python.png)](python/longest_uncommon_subsequence_I.py) |
142142
| 530 | [Minimum Absolute Difference in BST](https://leetcode.com/problems/minimum-absolute-difference-in-bst) | Easy | |
143143
| 532 | [K - Diff Pairs in Array](https://leetcode.com/problems/k-diff-pairs-in-an-array) | Easy | |
144144
| 538 | [Convert BST to Greater Tree](https://leetcode.com/problems/convert-bst-to-greater-tree) | Easy | |
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Solution:
2+
def findLUSlength(self, a: str, b: str) -> int:
3+
if a == b: return -1
4+
return max(len(a), len(b))

src/LongestUncommonSubsequenceI.java

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public class LongestUncommonSubsequenceI {
2+
public int findLUSlength(String a, String b) {
3+
if (a.equals(b)) return -1;
4+
return Math.max(a.length(), b.length());
5+
}
6+
}

0 commit comments

Comments
 (0)