Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.com/test/58htplkrt72/questions/63tsdplisc6
rview 150
New folder
Question 1
Given a string, seq, that consists of the characters 'A' and 'B' 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 0-based indexing, the following moves are optimal.
Jelete the substring "AB" starting at index 1. "BABBA" " BBA "
Delete the substring "BB" starting at index 0. "BBA" "A"
There are no more moves, so the minimum possible length of the remaining string is 1.
Function Description
Complete the function getMinLength in the editor below.
getMinLength has the following parameter(s):
string seq: the string
Returns
int: the minimum possible length of the remaining string
Type here to search
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

8.1 Differentiate between onboarding and training.

Answered: 1 week ago

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago

Question

3. What strategies might you use?

Answered: 1 week ago