Using C++ programming language solve the following problem: You are given a character parenthesis array and an integer array. You need to find the maximum sum sub-array in the integer array such that...


Using C++ programming language solve the following problem:<br>You are given a character parenthesis array and an integer array.<br>You need to find the maximum sum sub-array in the integer array such that<br>the corresponding sub-array in the character array has balanced<br>parenthesis.<br>Formally, a balanced parenthesis is subset of { [,],{,},<,>,(,) }* defined<br>recursively as follows:<br>• The empty string is balanced parentheses.<br>If A is balanced parentheses, then so are the strings [A], {A}u <A>,<br>(A).<br>If A and B are balanced parenthesis, then so is the string AB.<br>Input Contains:<br>First line contains T, the number of test cases.<br>• First line of each test case contains integer N.<br>• Next two lines contain the character array and the integer array<br>respectively, each having N elements.<br>Input:<br>1<br>-2 -1 34<br>Output:<br>7<br>

Extracted text: Using C++ programming language solve the following problem: You are given a character parenthesis array and an integer array. You need to find the maximum sum sub-array in the integer array such that the corresponding sub-array in the character array has balanced parenthesis. Formally, a balanced parenthesis is subset of { [,],{,},<,>,(,) }* defined recursively as follows: • The empty string is balanced parentheses. If A is balanced parentheses, then so are the strings [A], {A}u
, (A). If A and B are balanced parenthesis, then so is the string AB. Input Contains: First line contains T, the number of test cases. • First line of each test case contains integer N. • Next two lines contain the character array and the integer array respectively, each having N elements. Input: 1 -2 -1 34 Output: 7


Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here