Minimum Operations to Make Array Modulo Alternating II
Price each residue for the even and odd positions, then choose two different residues that together cost the least.
Price each residue for the even and odd positions, then choose two different residues that together cost the least.