3
bool helper(int &ind, TreeNode *root, vector<int> &voyage, vector<int> &ans) {4
if (root == NULL || ind == voyage.size()) {9
// Not possible to create10
if (root->val != voyage[ind]) {16
// If voyage value not equal to its left child, then swap both childs and18
if (root->left && root->left->val != voyage[ind + 1]) {19
TreeNode *temp = root->left;20
root->left = root->right;23
// Pusing root into ans24
ans.push_back(root->val);27
return helper(++ind, root->left, voyage, ans) && helper(++ind, root->right, voyage, ans);30
vector<int> flipMatchVoyage(TreeNode *root, vector<int> &voyage) {33
helper(ind, root, voyage, ans);