Vivek and birthday celebration


What’s the mistake in my code as it’s not passing all the test cases?

I didn’t get ur approach. Can u please elaborate it?

I applied topological sort and when a particular node’s indegree become zero then I am checking if it has any child or not. If not then it has no dependencies and vivek can skip inviting him