Split Into Two

Company: Ibm_23sep

Difficulty: medium

Problem Statement

Split Into Two Problem Description You are given an array arr of n integers. Cut the array at one position so that it falls into two non-empty contiguous parts: a left part made of the first k elements, and a right part made of the remaining n - k elements. Both parts must be non-empty, so k can be any value from 1 to n - 1 . The elements keep their original order and every element belongs to exactly one part. Complete the function splitIntoTwo(arr) , which returns the number of cut positions for which the sum of the left part is strictly greater than the sum of the right part. Input Format Read from standard input. n arr[0] arr[1] ... arr[n-1] The first line contains an integer n , the number of elements. Each of the next n lines contains one integer arr[i] . Output Format Print a single integer: the number of cut positions where the left sum is strictly greater than the right sum. Constraints 2 <= n <= 28000 (inferred -- the source states n <= 10^5, which cannot fit within t