We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c48139a commit 8843915Copy full SHA for 8843915
9 October Postorder Traversal
@@ -0,0 +1,16 @@
1
+
2
+class Solution {
3
+ void post(Node* root, vector<int>& ans){
4
+ if (!root) return;
5
+ post(root->left, ans);
6
+ post(root->right, ans);
7
+ ans.push_back(root->data);
8
+ }
9
+ public:
10
+ vector<int> postOrder(Node* root) {
11
+ // code here
12
+ vector<int> ans;
13
+ post(root, ans);
14
+ return ans;
15
16
+};
0 commit comments