Description
Given votes cast at specific times, answer queries about who was leading at time t. In a tie, the person with the most recent vote wins.
Examples
Input:
persons=[0,1,1,0,0,1,0], times=[0,5,10,15,20,25,30], q(3)Output:
0Explanation:
At time 3, person 0 leading.
Input:
persons = [0,1,1,0,0,1,0], times = [0,5,10,15,20,25,30], arg3 = 3Output:
0Explanation:
Edge case returning zero.
Input:
persons = [2,1,2,1,2], times = [1,8,12,18,25], arg3 = 15Output:
2Explanation:
At time 15, counting votes up to that time: person 2 has 2 votes (times 1,12) and person 1 has 1 vote (time 8). Person 2 is leading with more votes.
Constraints
- •
1 ≤ persons.length ≤ 5000