C input for Path Sum II


  • 0
    A

    Hi,

    I am trying to solve the Path Sum II problem in C and the function is given as follows

    /**
     * Return an array of int arrays of size *returnSize.
     * The sizes of the int arrays are returned in *columnSizes.
     */
    int **pathSum(int candidates[], int n, int target, int *columnSizes, int *returnSize) {
        
    }
    

    My question is the tree expected to be stored as for a node at index i left child at 2i and right child at 2i+1,
    also what is the value for NULL in the candidate ?

    Regards,
    Arka


  • 0
    S

    I have the same question with you, Dose anyone know how the bi tree is stored and how to determine a node is a leaf node?


  • 0
    Z

    I assume the C code of this problem needs rewriting or detailed comments as I even do not see where the tree root is given. An arbitrary binary tree is not supposed to be stored in candidates as it is not necessarily a heap or perfect tree, where eh 2i and 2i+1 formula applies.


  • 0
    E

    but...R U ac?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.