John is going through his family photo album.There is a total of N people in the family labeled 0 to N-1.
Find out the number of members of his family who have more than or equal to X children.
Input specification:
Input1:N,denoting the total number of family members.
Input2:X,denoting the minimum number of children a family members should have in order to be included in john’s final set.
Input3:An array of N elements where the ith element denotes the parent of the ith index. If the value of the element is -1,then that family member has no parent.
Example:
Input1:1
Input2:0
Input3:{-1}
Output=1
Comments
Leave a comment