Raft joint consensus changes cluster membership without allowing the old and new configurations to make conflicting decisions. During the transition, a vote set must contain a majority of both configurations.
Design a JointQuorumChecker class:
JointQuorumChecker(int[] oldMembers, int[] newMembers) stores the two voter configurations.bool hasQuorum(int[] votes) returns whether the votes contain a strict majority of both configurations.A strict majority of a configuration with n members is floor(n / 2) + 1. Count each distinct voter ID at most once, even when it appears repeatedly in votes. Ignore IDs that belong to neither configuration. A voter present in both configurations contributes to both majority counts.
Each call evaluates only its supplied votes; votes do not carry over between calls. Do not modify any input array.
Input:
Output:
Explanation: Voters 2 and 3 form a two-voter majority of both three-member configurations.
Input:
Output:
Explanation: The old configuration has votes from 1 and 2, but the new configuration has only voter 2.
1 <= oldMembers.length, newMembers.length <= 10^50 <= oldMembers[i], newMembers[i] <= 10^90 <= votes.length <= 2 * 10^50 <= votes[i] <= 10^910^4 calls are made to hasQuorum.| Call | Returns |
|---|---|
| new JointQuorumChecker([1,2,3], [2,3,4]) | null |
| hasQuorum([2,3]) | true |
Voters 2 and 3 form a majority of both three-member configurations.
Run checks these cases. Submit also runs a larger hidden set.

