|
3 | 3 | importjava.util.ArrayList;
|
4 | 4 | importjava.util.Collections;
|
5 | 5 | importjava.util.List;
|
6 |
| -/**378. Kth Smallest Element in a Sorted Matrix QuestionEditorial Solution My Submissions |
7 |
| -Total Accepted: 5 |
8 |
| -Total Submissions: 7 |
9 |
| -Difficulty: Medium |
| 6 | +/**378. Kth Smallest Element in a Sorted Matrix |
| 7 | + * |
10 | 8 | Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.
|
11 | 9 |
|
12 | 10 | Note that it is the kth smallest element in the sorted order, not the kth distinct element.
|
|
21 | 19 | k = 8,
|
22 | 20 |
|
23 | 21 | return 13.
|
24 |
| -Note: |
| 22 | +
|
| 23 | + Note: |
25 | 24 | You may assume k is always valid, 1 ≤ k ≤ n2.*/
|
26 |
| -publicclassKthSmallestElementInASortedMatrix { |
| 25 | +publicclass_378 { |
27 | 26 | //brute force made it AC'ed, extreme test case needed for OJ
|
28 | 27 | publicintkthSmallest(int[][]matrix,intk) {
|
29 | 28 | List<Integer>list =newArrayList<Integer>();
|
|