4 line cpp solution nlog(n)


  • 1
    S
    sort(citations.begin(),citations.end());
    int cnt = 0, ret = 0;
    for(auto i=citations.rbegin(); i!=citations.rend(); ++i)
        ret = max(min(++cnt,*i),ret);
    return ret;

Log in to reply
 

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