Hi everyone, I am getting a test case wrong for this problem and have already spent multiple days debugging. Could somebody please take a look at my code and help me find the bug?
A few things about the code: - an Event consists of an array of the lowest indexed people that are contained in a segment, in sorted order.
the array e[i][j] is the segment from vertex i to its 2^(j-1)th parent, inclusive, and stores events. e[i][0] is just that node's event, ie a segment with only itself.
dp[i][j] is the 2^jth parent of node i.
anc returns the kth ancestor of a vertex.
mergeevent merges two events' persons that are contained, while maintaining sorted order.
removeDup removes duplicates in the array.
Thanks everyone!