Sponsored
Use these hints if you're stuck. Try solving on your own first.
Represent the state as DP[pos][mod]: maximum possible sum starting in the position "pos" in the array where the current sum modulo 3 is equal to mod.
Solve with full IDE support and test cases