you give integer array person time in election ith vote cast personsi time timesifor query time t find person lead election time t Votes cast time t count query in case tie recent vote tie candidate winsimplement topvotedcandidate classtopvotedcandidateint person int time Initializes object person times arraysint qint t return number person lead election time t accord mention rule Example 1inputtopvotedcandidate q q q q q q0 1 1 0 0 1 0 0 5 10 15 20 25 30 3 12 25 15 24 8outputnull 0 1 1 0 0 1explanationtopvotedcandidate topvotedcandidate new TopVotedCandidate0 1 1 0 0 1 0 0 5 10 15 20 25 30topvotedcandidateq3 return 0 at time 3 vote 0 0 leadingtopvotedcandidateq12 return 1 at time 12 vote 011 1 leadingtopvotedcandidateq25 return 1 at time 25 vote 011001 1 lead tie recent votetopVotedCandidateq15 return 0topvotedcandidateq24 return 0topvotedcandidateq8 return 1 Constraints1 personslength 5000timeslength personslength0 personsi personslength0 timesi 109time sort strictly increase ordertimes0 t 109at 104 call q