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 0-based indexing, the following moves are optimal. . Delete the substring "AB" starting at index 1. "BABBA" - "BBA" . Delete the substring "BB" starting at index 0. "BBA" -"A"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!