Question: Given an array A of length N , split it into mutually exclusive subarrays with an equal total product. Return the maximum number of parts

Given an array A of length N, split it into mutually exclusive subarrays with an equal total product. Return the maximum number of parts in a partition possible.NOTE A subarray is a contiguous subset of an array. 2 subarrays are mutually exclusive if they do not share any elements. ex: For the array [2,3,1,2],[2,3] and [1,2] are mutually exclusive subarrays. A partition of an array A is a set of mutually exclusive subarrays of A such that, each element in A is present in exactly one subarray. ex: For array [2,3,1,2],([2,3],[1,2]) is a partition of the array.135 INPUT A - the array to be partitioned. N - the length of array A. Test Time: 02:57:23Firish TestAttempted: 0/3JAVA17Compiler: Java -17import java.io.*;importI kead only region start class UserMainCode12public int easplit(int[] a,int n){Read only region end/ Write code here...throw new UnsupportedoperationException("eqSplit(int[] input1,int input2)");The maximum number of parts in a partition where each part has an equal total productReturn -1 if it is impossible to partition the array into at least 2 subarrays.CONSTRAINTS 1N <=100000<= values in A <=109EXAMPLEExample #1Input:899 A =[36,6,6,3,12]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!