FastPrepFastPrep
Problem Brief

Maximum Equal Deletion Sum

OA

You have an array A, of size N. There are 3 ways to delete elements:

  • first 2 elements
  • last 2 elements
  • first and last element
  • The array size should be greater than 2, if less, you cannot make any move. The question is to find in how many (maximum) moves, you can get deletion of equal sum.

    1Example 1

    Input
    A = [1, 9, 8, 9, 5, 1, 2]
    Output
    3
    Explanation

    You delete:

    1. first 2 elements (1,9) = 10
    2. first and last (8,2) = 10
    3. first and last (9,1) = 10

    So, total 3 moves, 3 is the answer.

    Constraints

    Limits and guarantees your solution can rely on.

    πŸ‹πŸ‹πŸŠπŸŠ
    public int maximumEqualDeletionSum(int[] A) {
      // write your code here
    }
    
    Input

    A

    [1, 9, 8, 9, 5, 1, 2]

    Output

    3

    Sign in to submit your solution.