Welcome to the daily solving of our PROBLEM OF THE DAY with Ayush Tripathi We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Prefix-Sum but also build up problem-solving skills.
Given an array of integers arr, return true if it is possible to split it in two subarrays (without reordering the elements), such that the sum of the two subarrays are equal. If it is not possible then return false.
Examples:
Input: arr = [1, 2, 3, 4, 5, 5]
Output: true
Explanation: In the above example, we can divide the array into two subarrays with eqaul sum. The two subarrays are: [1, 2, 3, 4] and [5, 5]. The sum of both the subarrays are 10. Hence, the answer is true.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/split-an-array-into-two-equal-sum-subarrays/1