package leetcode;

/**
 * https://leetcode.com/problems/find-kth-largest-xor-coordinate-value/
 */
public class Problem1738 {
    public int kthLargestValue(int[][] matrix, int k) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1738 prob = new Problem1738();
        System.out.println(prob.kthLargestValue(new int[][]{
            {5,2},{1,6}
        }, 1)); // 7
        System.out.println(prob.kthLargestValue(new int[][]{
            {5,2},{1,6}
        }, 2)); // 5
        System.out.println(prob.kthLargestValue(new int[][]{
            {5,2},{1,6}
        }, 3)); // 4
        System.out.println(prob.kthLargestValue(new int[][]{
            {5,2},{1,6}
        }, 4)); // 0
    }
}

@@ -187,15 +187,1011 @@
     
-// TODO
+int maxRow = matrix.length;%0A        int maxCol = maxRow %3E 0 ? matrix%5B0%5D.length : 0;%0A        int xor1 = 0;%0A        for (int row = 0; row %3C maxRow; row++) %7B%0A            int xor2 = 0;%0A            for (int col = 0; col %3C maxCol; col++) %7B%0A                if (col == 0) %7B%0A                    xor2 = matrix%5Brow%5D%5Bcol%5D;%0A                %7D else %7B%0A                    xor2 %5E= matrix%5Brow%5D%5Bcol%5D;%0A                %7D%0A            %7D%0A            if (row == 0) %7B%0A                xor1 = xor2;%0A            %7D else %7B%0A                xor1 %5E= xor2;%0A            %7D%0A        %7D%0A        xor1 = 0;%0A        for (int col = 0; col %3C maxCol; col++) %7B%0A            int xor2 = 0;%0A            for (int row = 0; row %3C maxRow; row++) %7B%0A                if (col == 0) %7B%0A                    xor2 = matrix%5Brow%5D%5Bcol%5D;%0A                %7D else %7B%0A                    xor2 %5E= matrix%5Brow%5D%5Bcol%5D;%0A                %7D%0A            %7D%0A            if (col == 0) %7B%0A                xor1 = xor2;%0A            %7D else %7B%0A                xor1 %5E= xor2;%0A            %7D%0A        %7D
 %0A   

Update problem 1738