JUST FIND IT SOLUTIONS CFS2002

JUST FIND IT SOLUTIONS CFS2002  CodeFusion 20.9

Given an exhibit $A$ of length $N$. 
 
We need to discover the $maximum$ aggregate of components of the subarray between $two$ closest events of $same$ components (barring both). On the off chance that both the components are $even$, at that point the all out number of $even$ components in that subarray ought to be $even$ at that point and afterward just we consider that subarray and in the event that both the components are $odd$, at that point the complete number of $odd$ component in that subarray ought to be $odd$ at that point and afterward just we consider that subarray. 
 
On the off chance that the condition never coordinates print $0$. 
 
Information: 
 
First line contains $T$, number of experiments. At that point the experiments follow. 
 
Each testcase comprises of two lines: The primary line has $N$ : number of components in the exhibit and second-line has $N$ space isolated whole numbers: components of the cluster. 
 
Yield: 
 
For each experiment, yield in a solitary line $maximum$ aggregate. 
 
Limitations 
 
$1 leq T leq 10$ 
 
$3 leq N leq 2*10^5$ 
 
$1 leq A[i] leq 10^8$ 
 
$NOTE $: Use of Fast Input Output is suggested. 
 
Test Input: 
 
 
10 
 
1 2 3 2 1 5 1 2 8 2 
 
Test Output: 
 
 
Clarification: 
 
The greatest entirety is 7, between 1 at first position and 1 at fifth position i.e aggregate of 2,3,2
 

Leave a Comment

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+