[Solution] Minimum number of Flips CodeChef Solution | CodeChef Problem Solution 2022
Chef has an array of length consisting of and only.
In one operation, Chef can choose any index and multiply the element by .
Find the minimum number of operations required to make the sum of the array equal to . Output -1
if the sum of the array cannot be made .
Input Format
- First line will contain , number of test cases. Then the test cases follow.
Solution Click Below:- CLICK HERE
- First line of each test case consists of a single integer denoting the length of the array.
- Second line of each test case contains space-separated integers denoting the array .
Output Format
For each test case, output the minimum number of operations to make the sum of the
array equal to . Output -1
if it is not possible to make the sum equal to .
No comments:
Post a Comment