Answered step by step
Verified Expert Solution
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 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:SRRBRBBRRHe can choose the substring RBBR and as there are RED attacks and BLUE attacks, he can combine and perform the PURPLE attack.Detailed explanation Inputoutput format, Notes. Images Constraints : cc IS where S is the string of attacks.It is guaranteed that the sum of IS over all test cases won't exceed Time Limit secondSample Input :RBRRBBRSample Output :YESNOExplanation Of Sample Input :Explanation Of Sample Input :For test case :He can choose the substring RBRRBB As there are RED attacks and BLUE attacks, he can combine and perform the PURPLE attack.For test case :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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started