Using C++11 Lambda to form the comparator


  • 0
    R

    C++ Lambda: It's clean, and worth a try.

    sort(intervals.begin(), intervals.end(), [] (const Interval& i1, const Interval& i2)
          {return i1.start < i2.start;});

Log in to reply
 

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