C++ approach easy to understand


#1
`vector<int> Solution::inorderTraversal(TreeNode* A) {
vector<int>res;
stack<TreeNode*>st;
TreeNode* trav;
trav = A->left;
while(trav){
    st.push(trav);
    trav = trav->left;
}
while(!st.empty()){
    TreeNode* ch = st.top();
    st.pop();
    res.push_back(ch->val);
    if(ch->right){
        ch = ch->right;
        while(ch){
            st.push(ch);
            ch = ch->left;
        }
    }
}
res.push_back(A->val);
trav = A->right;
while(trav){
    st.push(trav);
    trav = trav->left;
} 
   while(!st.empty()){
    TreeNode* ch = st.top();
    st.pop();
    res.push_back(ch->val);
    ch->val = INT_MAX-1;
    if(ch->right){
        ch = ch->right;
        while(ch){
            st.push(ch);
            ch = ch->left;
        }
    }
} 
return res;
}`