How to initialize the array using malloc in Binary Tree Inorder Traversal in C ?


  • 0
    S

    /**

    • Definition for a binary tree node.
    • struct TreeNode {
    • int val;
      
    • struct TreeNode *left;
      
    • struct TreeNode *right;
      
    • };
      /
      /
      *
    • Return an array of arrays of size *returnSize.
    • The sizes of the arrays are returned as *columnSizes array.
    • Note: Both returned array and columnSizes array must be malloced, assume caller calls free().
      /
      int
      levelOrder(struct TreeNode* root, int** columnSizes, int* returnSize) {
      }

    What is the meaning of returnSize, columnSizes here?
    How do you initialize the array using malloc with the help of returnSize and ColumnSizes in C?
    Please provide your code snippet.


Log in to reply
 

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