aboutsummaryrefslogtreecommitdiff
path: root/find_kth_large_xor_coord.c
diff options
context:
space:
mode:
Diffstat (limited to 'find_kth_large_xor_coord.c')
-rw-r--r--find_kth_large_xor_coord.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/find_kth_large_xor_coord.c b/find_kth_large_xor_coord.c
index 2611be1..e8bfe81 100644
--- a/find_kth_large_xor_coord.c
+++ b/find_kth_large_xor_coord.c
@@ -29,14 +29,16 @@ int kthLargestValue(int **matrix, int matrixSize, int *matrixColSize, int k) {
int main() {
int matrix_input[2][2] = {{5, 2}, {1, 6}};
- struct two_d_arr matrix;
- two_d_arr_init(&matrix, ARRAY_SIZE(matrix_input), ARRAY_SIZE(matrix_input[0]),
- matrix_input);
- printf("%d\n", kthLargestValue(matrix.arr, matrix.row_size, matrix.col_size,
- 1)); // expect: 7
- printf("%d\n", kthLargestValue(matrix.arr, matrix.row_size, matrix.col_size,
- 2)); // expect: 5
- printf("%d\n", kthLargestValue(matrix.arr, matrix.row_size, matrix.col_size,
- 3)); // expect: 4
- two_d_arr_free(&matrix);
+ struct two_d_arr *matrix = two_d_arr_init(
+ ARRAY_SIZE(matrix_input), ARRAY_SIZE(matrix_input[0]), matrix_input);
+ printf("%d\n",
+ kthLargestValue(matrix->arr, matrix->row_size, matrix->col_size,
+ 1)); // expect: 7
+ printf("%d\n",
+ kthLargestValue(matrix->arr, matrix->row_size, matrix->col_size,
+ 2)); // expect: 5
+ printf("%d\n",
+ kthLargestValue(matrix->arr, matrix->row_size, matrix->col_size,
+ 3)); // expect: 4
+ two_d_arr_free(matrix);
}