Intuitive Javascript Solution


  • 1
    D
    var findLUSlength = function(a, b) {
        // identical strings don't have uncommon subsequence
        if (a === b) return -1;
        // the longer string itself is the longest uncommon subsequence
        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.