Easy 1 line solution


  • 0
    D

    public class Solution {
    public int findLUSlength(String a, String b) {

        //Unless the 2 strings are equal, the string which is of a longer length will have the longest uncommon subsequence
        if(a.equals(b))
            return -1;
        else
            return Math.max(a.length(),b.length());
        
    }
    

    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.