Minimum steps to delete a string
Easy Accuracy: 33.78% Submissions: 329 Points: 2

Given string s containing characters as integers only, the task is to delete all characters of this string in a minimum number of steps wherein one step you can delete the substring which is a palindrome. After deleting a substring remaining parts are concatenated.

Example 1:

Input: s = "2553432"
Output: 2
Explanation: In first step remove "55", 
then string becomes "23432" which is a 
Example 2:
Input: s = "1234"
Output: 4
Explanation: Remove each character in 
each step

Your Task:  
You don't need to read input or print anything. Complete the function minStepToDeleteString() which string s as input parameters and returns the integer value

Expected Time Complexity: O(|s|2)
Expected Auxiliary Space: O(|s|2)

1 ≤ |s| ≤ 103

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Minimum steps to delete a string

Output Window