Implement Raft Leader Election
terms, votes and majority quorum
Challenge 4 of Coordination & ConsensusAdvanced~60 min
Elect a single leader in a cluster where nodes crash and messages drop, the heart of the Raft consensus algorithm. Implement the election: a node bumps its term and becomes a candidate, peers grant at most one vote per term, a candidate that wins a majority becomes leader, and any node that sees a newer term immediately steps down. The mechanism that keeps etcd, Consul, and CockroachDB consistent.