Please help me to solve this problem

Правка en2, от Just_LOL, 2024-03-04 12:44:40

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 'aaaaba' 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
Теги dp, string, help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Just_LOL 2024-03-04 12:44:40 2 Tiny change: 'xample 'aaba' when' -> 'xample 'aaaaba' when'
en1 Английский Just_LOL 2024-03-03 11:04:38 508 Initial revision (published)