8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6cc532c commit a464cdeCopy full SHA for a464cde
src/main/java/com/fishercoder/solutions/_1439.java
@@ -13,6 +13,8 @@ public static class Solution1 {
13
* 2. priority queue doesn't help in this case unless used in combination with a set to filter out duplicates;
14
* 3. implement a customized comparator for treeset: if sum i.e. entry[0] doesn't equal, then it's not a duplicate,
15
* then we compare the rest of the elements in the array, as long as anyone of them differs at the same index, it's not a duplicate.
16
+ *
17
+ * Again, using a pen and paper to visualize my thought process helps a lot!
18
*/
19
public int kthSmallest(int[][] mat, int k) {
20
TreeSet<int[]> treeSet = new TreeSet<>(new Comparator<int[]>() {
0 commit comments