2545. Sort the Students by Their Kth Score leetcode problem Solution c++ | How to sort 2D vectors in c++ using a custom comparator in c++
2545. Sort the Students by Their Kth Score Solution c++- How to sort 2D vectors in c++ using a custom comparator in c++. This problem is part of leetcode 2545. Here we have to sort a 2D vector using custom comparator lets read problem statement first problem statement - There is a class with m students and n exams. You are given a 0-indexed m x n integer matrix score , where each row represents one student and score[i][j] denotes the score the i th student got in the j th exam. The matrix score contains distinct integers only. You are also given an integer k . Sort the students (i.e., the rows of the matrix) by their scores in the k th ( 0-indexed ) exam from the highest to the lowest. Return the matrix after sorting it. Example 1: Input: score = [[10,6,9,1],[7,5,11,2],[4,8,3,15]], k = 2 Output: [[7,5,11,2],[10,6,9,1],[4,8,3,15]] Explanation: In the above diagram, S denotes the student, while E denotes the exam. - The student with index 1 scored 11 in exa