Minimum Priority Queue to sort activities in ascending order of finishing time ( f [ i ] ) .
PriorityQueue < Pair > p = new PriorityQueue < > ( ( p1 , p2 ) -> p1 . first - p2 . first ) ; for ( int i = 0 ; i < s . length ; i ++ ) {