Question: You can write in any Language !! Your Choice !! Please Hurry up !! Problem Statement You are given an array A of N integers.
You can write in any Language !! Your Choice !! Please Hurry up !!


Problem Statement You are given an array A of N integers. Hamo decided to split the array into continuous subarrays (A[1], A[2], ... A[11]) (A[i1+1], A[i1+2), ... A[12])... (A[im-1+1), Aim-1+2], ... A[iml) such that the following conditions hold: Size of each subarray is at least 2 (ik - Ik-1 > 1) A[i] > A[j] for every j where j Ik-1 (io = 1) . The value of splitting is defined as (A[in]-A[1]) + (A[12]-A[11+1]) + .. (A[iM]-A[im-1+1]). Your task is to find the minimum possible value of splitting that Hamo can achieve. You need to return 0 if Hamo cannot split the array. Since the answer can be very large return it modulo 10^9+7. Input Format The first line contains an integer, N, denoting the number of elements in A. Each line i of the N subsequent lines (where 0 si
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
