Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What am I doing wrong here? Keep it simple please * Balanced strings are those who have equal quantity of L and * R characters.

image text in transcribed

image text in transcribed

What am I doing wrong here? Keep it simple please

* Balanced strings are those who have equal quantity of "L" and * "R" characters. Given a balanced string s split it in the maximum * amount of balanced strings. Return the maximum amount of splitted * balanced strings * Example 1: * input: "RLRRLLRLRL" * output: 4 * Explanation: "RLRRLLRLRL" can be split into "RL", "RRLL", "RL", "RL", * since each substring contains the same number of "L" and R" * Example 2 : * input: "RLLLLRRRR" * output: 3 * Explanation: "RLLLLRRRLR" can be split into "RL", "LLLRRR", "LR", * since each substring contains the same number of "L" and "R" * Example 3 : * input: "LLLLRRRR" * output: 1 * Explanation: "LLLLRRRR" can be split into "LLLLRRRR" * Example 4 : * input: "RLRRRLLRLL" * output: 2 * Explanation: "RLRRRLLRLL" can be split into "RL", "RRRLLRLL", * since each substring contains the same number of "L" and "R" * Please write a program to achieve this goal and name it CountBalancedStrings.java */

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions