Question: Given a string seq consisting of the characters ' A ' and ' B ' only, in one move, you can delete either an
Given a string seq consisting of the characters A and B only, in one move, you can delete either an AB or a BB substring. After a move, the remaining parts of the string get concatenated. Find the minimum possible length of the remaining string after performing any number of moves. Note: A substring is a contiguous subsequence of a string. Example seq "BABBA" Using based indexing, the following moves are optimal. Delete the substring AB starting at index "BABBA" "BBA" Delete the substring BB starting at index "BBA" A
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
