#include "TreeNode.h"
#include <stdbool.h>

bool in_order(struct TreeNode *root, int target, int sum)
{
    if (!root)
        return false;

    if (!root->left && !root->right)
        return sum + root->val == target;

    return in_order(root->left, target, sum + root->val) || in_order(root->right, target, sum + root->val);
}

bool hasPathSum(struct TreeNode *root, int targetSum)
{
    return in_order(root, targetSum, 0);
}

int main()
{
    return 0;
}
