diff options
Diffstat (limited to 'count_number_root_nodes.c')
-rw-r--r-- | count_number_root_nodes.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/count_number_root_nodes.c b/count_number_root_nodes.c index ba684ea..93f368d 100644 --- a/count_number_root_nodes.c +++ b/count_number_root_nodes.c @@ -1,5 +1,6 @@ // 2581. Count Number of Possible Root Nodes #include "leetcode.h" +#include <stdio.h> bool check(int *nums, int nums_size, int k) { for (int i = 0; i < nums_size; i++) @@ -88,17 +89,16 @@ int main() { g1i[4][2] = {{1, 3}, {0, 1}, {1, 0}, {2, 4}}; int e2i[4][2] = {{0, 1}, {1, 2}, {2, 3}, {3, 4}}, g2i[4][2] = {{1, 0}, {3, 4}, {2, 1}, {3, 2}}; - struct two_d_arr e1, g1, e2, g2; - two_d_arr_init(&e1, 4, 2, e1i); - two_d_arr_init(&g1, 4, 2, g1i); - two_d_arr_init(&e2, 4, 2, e2i); - two_d_arr_init(&g2, 4, 2, g2i); - printf("%d\n", rootCount(e1.arr, e1.row_size, e1.col_size, g1.arr, - g1.row_size, g1.col_size, 3)); // expect: 3 - printf("%d\n", rootCount(e2.arr, e2.row_size, e2.col_size, g2.arr, - g2.row_size, g2.col_size, 1)); // expect: 5 - two_d_arr_free(&e1); - two_d_arr_free(&g1); - two_d_arr_free(&e2); - two_d_arr_free(&g2); + struct two_d_arr *e1 = two_d_arr_init(4, 2, e1i); + struct two_d_arr *g1 = two_d_arr_init(4, 2, g1i); + struct two_d_arr *e2 = two_d_arr_init(4, 2, e2i); + struct two_d_arr *g2 = two_d_arr_init(4, 2, g2i); + printf("%d\n", rootCount(e1->arr, e1->row_size, e1->col_size, g1->arr, + g1->row_size, g1->col_size, 3)); // expect: 3 + printf("%d\n", rootCount(e2->arr, e2->row_size, e2->col_size, g2->arr, + g2->row_size, g2->col_size, 1)); // expect: 5 + two_d_arr_free(e1); + two_d_arr_free(g1); + two_d_arr_free(e2); + two_d_arr_free(g2); } |