36ms fastest C++ solution in 3 lines


  • 0
    W
        int *gp = g.data(), *sp = s.data(), *ge = gp + g.size(), *se = sp + s.size();
        for(std::sort(gp, ge), std::sort(sp, se); sp < se && (*sp < *gp || ++gp < ge); ++sp);
        return gp - g.data();

Log in to reply
 

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