Question: You are given an array A consisting of N numbers. In one move you can delete either the first two, the last two, or the
You are given an array A consisting of numbers. In one move you can delete either the first two, the last two, or the first and last elements of A No move can be performed if the length of is smaller than The result of each move is the sum of the deleted elements.
Write a function:
def solution
that, given an array of integers, returns the maximum number of moves that can be performed on A such that all performed moves have the same result.
Examples:
Given the function should return The first move should delete two last elements and with sum then The second move may delete first and last elements and with sum then The third move should delete first two elements and with sum then
Given the function should return It is possible to delete the first and last elements four times, as each
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
