Alternating Cost of a Binary String

Company: Google_12oct

Difficulty: medium