Please help me to solve this problem

Revision en1, by Just_LOL, 2024-03-03 11:04:38

You are given an string s of length n. And there is a eraser and it deletes neighboring characters of a particular letter when it place on a specific position. For an example 'aaba' when we place eraser on 1st 'a'(index 0), string becomes 'ba' (since we deleted all the letters of the neighboring 'a's). Task is to delete the entire string in minimum operations.

Test 1
Input -> 6 aabcbb
Output -> 3
Constraints
1<=n<=1000
Tags dp, string, help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Just_LOL 2024-03-04 12:44:40 2 Tiny change: 'xample 'aaba' when' -> 'xample 'aaaaba' when'
en1 English Just_LOL 2024-03-03 11:04:38 508 Initial revision (published)