Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LeetCode URL: https://leetcode.com/problems/longest-uncommon-subsequence-i/
- /**
- * Refer:
- * https://leetcode.com/problems/longest-uncommon-subsequence-i/discuss/99410/I-feel-this-problem-is-just-perfect-for-April-Fools'-day/103474
- *
- * Time Complexity: (min(A, B))
- *
- * Space Complexity: O(1)
- *
- * A = Length of string a. B = Length of string b.
- */
- class Solution {
- public int findLUSlength(String a, String b) {
- if (a == null || b == null || a.equals(b)) {
- return -1;
- }
- return Math.max(a.length(), b.length());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement