Maximum Total Value of Covered Indices
Each token either stays put or steps one place left. Count every occupied index once and keep the best total with a two-state scan.
Each token either stays put or steps one place left. Count every occupied index once and keep the best total with a two-state scan.