this is the helper which has duplicate code


  • 0
    J

    public int helper(NestedInteger ni,int level) {
    int res=0;
    if(ni.isInteger()) {
    res=ni.getInteger()*level;
    } else {
    for(NestedInteger nii:ni.getList()) {
    res+=helper(nii,level+1);
    }
    }
    retun res;

    }


Log in to reply
 

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