STREDUCE - String reduction
Given a string containing only characters of 'a' and 'b'. You can reduce this string by replacing a substring forming a?a or b?b by ?; ? is 'a' or 'b'.
Find a way to minimize the length of given string by reducing it. Output that minimum length.
- A string.
- The minimum length found.
- The length of the given string does not exceed 300.
can answer be anything different than 1, 2 or length ?? if yes case pls
Very nice question....
I am getting WA even though my solution looks correct! ..Kindly post some tricky testcases so that I can verify my answer..Thanks!
tough!!Last edit: 2012-06-17 18:42:48
n^3 dp AC passes in 3.11 sec
M Misbachul Huda:
I still geting WA, please help me !
will O((n^3)*25) solution pass?
Pawel Gawrychowski is right...After getting several WA, i noticed his post and finally got ac... So,DONT USE GETS().
I've found that this problem originally comes from NEERC 2001, Western Subregion.