int countNodes(TreeNode* root) { int left_depth = countLeft(root); int right_depth = countRight(root); if (left_depth == right_depth){ return ((1 << (left_depth+1)) - 1); } else{ return countNodes(root->left)+countNodes(root->right)+1; } }
void PlaceOrderTodo::checkout() { assert( countLeft() > 0 ); curIndex++; }
void ContractDetailsTodo::checkout() { assert( countLeft() > 0 ); curIndex++; }