Akamai interview question

1 string q, 1 dp, 1 array