Problem 2745 · Medium

Construct the Longest New String

Choose AA, BB and AB blocks without AAA or BBB; a DP over used counts tracks how the string ends so each block is placed legally.

Open the interactive visualisation