Compilation error saying , it can't identify symbol getRootFromList(int[],int,int)


  • 0
    V

    public class Solution {
    public TreeNode sortedArrayToBST(int[] num) {
    int start = 0;
    int end = num.length-1;

     TreeNode n = this.getRootfromList(num,start,end);
     return n;
     //return (this.getRootFromList(num,start,end));
     
        
    }
    
    public TreeNode getRootfromList(int[] num, int start, int end)
    {
        
        if(start<= end) return null;
        int mid =   (start + end )/2 ;
    
        TreeNode node = new TreeNode(num[mid]);
        
        node.left = getRootFromList(num,start,mid-1);
        node.right = getRootFromList(num,mid+1,end);
        
        return node;
    }
    

    }


  • 0
    S
    This post is deleted!

Log in to reply
 

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