Doubt on leetcode binary


question=894. All Possible Full Binary Trees leetcode

Please correct my solu and send

refer this code https://ide.codingblocks.com/s/578316
explained with comments. hope it resolves all ur doubts

// for (int i = 2; i <= N; i += 2) {

why is it incremented by 2

Also I did not understand line no 15 and 19

TreeNode* clone(TreeNode* root) {
    TreeNode* new_root = new TreeNode(0);
    new_root->left = (root->left) ? clone(root->left) : nullptr;
    new_root->right = (root->right) ? clone(root->right) : nullptr; 
    return new_root;
  } 

forgot to add this function in the above code i gave

// for (int i = 2; i <= N; i += 2) {

why is it incremented by 2?
and why we are using clone here??
Also can u tell me what was with my approach

ok… i found error in ur code. in line 17 u had used comas instead of semicolon. secondly there was some issues with brackets.
I have corrected ur code. https://ide.codingblocks.com/s/578387
It is now getting successfully submitted.
Hope ur doubt is cleared now.

I am closing this doubt. if u still have any queries u can reopen the doubt again

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.