Company: IBM_2oct_oncampus
Difficulty: medium
Split Into Two Problem Description Given an array of integers, find the number of ways to split the entire array into two non-empty subarrays, left and right, such that the sum of elements in the left subarray is greater than the sum of elements in the right subarray. Function Description Complete the function splitIntoTwo in the editor with the following parameter: int arr[] : integer array Returns: int : the number of ways to split the array such that the left sum is greater than the right sum int splitIntoTwo(vector arr) { // Complete the 'splitIntoTwo' function below. // The function is expected to return an INTEGER. // The function accepts INTEGER_ARRAY arr as parameter. } Examples Example 1: Input: arr = [10, -5, 6] Output: 1 Explanation: There are two ways to split the array: [10], [-5, 6] (10 > 1) and [10, -5], [6] (5 Example 2: Input: arr = [-3, -2, 1, 20, -30] Output: 2 Explanation: There are two ways to split arr into two non-empty subarrays such that the sum of elements in