Question: lackerRank Question - QuE hackerrank.com / test / 5 8 htplkrt 7 2 / questions / 6 3 tsdplisc 6 rview 1 5 0 New
lackerRank Question QuE
hackerrank.comtesthtplkrtquestionstsdplisc
rview
New folder
Question
Given a string, seq, that consists of the characters A and only, in one move, delete either an AB or a BB substring and concatenate the remaining substrings.
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.
Jelete the substring AB starting at index "BABBA" BBA
Delete the substring BB starting at index "BBA" A
There are no more moves, so the minimum possible length of the remaining string is
Function Description
Complete the function getMinLength in the editor below.
getMinLength has the following parameters:
string seq: the string
Returns
int: the minimum possible length of the remaining string
Type here to search
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
