Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem statementSend feedbackGojo has 2 weapons RED and BLUE. His attacks are given to you in a string. He can choose any substring which is

Problem statementSend feedbackGojo has 2 weapons RED and BLUE. His attacks are given to you in a string. He can choose any substring which is not empty and if it has equal number of RED and BLUE attacks, he can combine them and perform PURPLE ATTACK.Your task is to determine if it is possible to perform the PURPLE attack.Example:'S'="RRBRBBRR"He can choose the substring "RBBR" and as there are 2 RED attacks and 2BLUE attacks, he can combine and perform the PURPLE attack.Detailed explanation (Input/output format, Notes. Images )Constraints :1 c=<=101c= IS|<=101.3, where S is the string of attacks.It is guaranteed that the sum of IS over all test cases won't exceed '10^5'.Time Limit 1 secondSample Input 1:RBRRBBRSample Output 1:YESNOExplanation Of Sample Input 1:Explanation Of Sample Input 1:For test case 1:He can choose the substring "RBRRBB". As there are 3 RED attacks and 3BLUE attacks, he can combine and perform the PURPLE attack.For test case 2:There is no substring where the number of RED and BLUE attacks are equal:

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

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

Using Figure

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago