Simple Greedy with Java


  • 0
    H

    Arrays.sort(s);
    if (g.length > s.length){
    return s[g.length-s.length];
    }
    else if (s.length > g.length){
    return s[s.length-g.length];
    }
    else {
    return s[s.length-1];
    }


Log in to reply
 

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