diff options
Diffstat (limited to 'leetcode.h')
-rw-r--r-- | leetcode.h | 40 |
1 files changed, 2 insertions, 38 deletions
@@ -1,4 +1,5 @@ #pragma once + #include "lib/uthash/src/uthash.h" #include <assert.h> #include <ctype.h> @@ -11,43 +12,6 @@ #include <stdlib.h> #include <string.h> -#ifdef __cplusplus -#include <bits/stdc++.h> -using namespace std; - -typedef vector<vector<int>> vvd; - -struct ListNode { - int val; - ListNode *next; - ListNode() : val(0), next(nullptr) {} - ListNode(int x) : val(x), next(nullptr) {} - ListNode(int x, ListNode *next) : val(x), next(next) {} -}; - -struct TreeNode { - int val; - TreeNode *left; - TreeNode *right; - TreeNode() : val(0), left(nullptr), right(nullptr) {} - TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} - TreeNode(int x, TreeNode *left, TreeNode *right) - : val(x), left(left), right(right) {} -}; - -class Node { -public: - int val; - vector<Node *> children; - Node() {} - Node(int _val) { val = _val; } - Node(int _val, vector<Node *> _children) { - val = _val; - children = _children; - } -}; -#else //__cplusplus - struct two_d_arr { int row_size; int *col_size; @@ -76,6 +40,7 @@ void two_d_arr_init(struct two_d_arr *obj, int row_size, int col_size, void two_d_arr_free(struct two_d_arr *obj); struct ListNode *listnode_create(int val); +struct ListNode *listnode_build(int *vals, int size); void listnode_print(struct ListNode *head); void listnode_free(struct ListNode *head); @@ -94,4 +59,3 @@ void node_free(struct Node *root); #define ARRAY_SIZE(array) \ (__builtin_choose_expr(IS_ARRAY((array)), \ sizeof((array)) / sizeof((array)[0]), (void)0)) -#endif |