aboutsummaryrefslogtreecommitdiff
path: root/leetcode.h
diff options
context:
space:
mode:
Diffstat (limited to 'leetcode.h')
-rw-r--r--leetcode.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/leetcode.h b/leetcode.h
index 7a4095b..fa54916 100644
--- a/leetcode.h
+++ b/leetcode.h
@@ -1,12 +1,12 @@
+#include "lib/uthash/src/uthash.h"
+#include <ctype.h>
+#include <limits.h>
#include <math.h>
+#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdbool.h>
-#include <limits.h>
-#include <ctype.h>
-#include <stdint.h>
-#include "lib/uthash/src/uthash.h"
#ifdef __cplusplus
#include <bits/stdc++.h>
@@ -43,7 +43,24 @@ public:
children = _children;
}
};
-#endif //__cplusplus
+#else //__cplusplus
+
+struct ListNode {
+ int val;
+ struct ListNode *next;
+};
+
+struct TreeNode {
+ int val;
+ struct TreeNode *left;
+ struct TreeNode *right;
+};
+
+struct ListNode *listnode_create(int val);
+void listnode_print(struct ListNode *head);
+
+struct TreeNode *treenode_create(int val);
+void treenode_print(struct TreeNode *root);
#define IS_ARRAY(value) \
(!__builtin_types_compatible_p(typeof((value)), typeof(&(value)[0])))
@@ -51,4 +68,4 @@ public:
#define ARRAY_SIZE(array) \
(__builtin_choose_expr(IS_ARRAY((array)), \
sizeof((array)) / sizeof((array)[0]), (void)0))
-
+#endif