Counting Problem (DP)

Revision en1, by agaurav77, 2015-08-08 19:02:15

Hi everyone!

I am trying to learn DP, and I stumbled across this question on TopCoder. While I have a hunch that it will involve bitmasks, the naive approach, i.e. generating all the sequences, simulating the matches and finding the solution would involve O(n.n!) time. And that's too much for 2 ≤ n ≤ 16.

I have some other unformed ideas, but I wanted to know how do I tackle such problems in general? Thanks!

Tags dp, topcoder

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English agaurav77 2015-08-08 19:02:15 514 Initial revision (published)