• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
September 24, 2023 |1.3K Views

PROBLEM OF THE DAY: 23/09/2023 | Equilibrium Point

Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Siddharth Hazra. 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 will also help you build up problem-solving skills.

In this video, we are given an array A of n positive numbers. The task is to find the first equilibrium point in an array. Equilibrium point in an array is a position such that the sum of elements before it is equal to the sum of elements after it.

Note: Return equilibrium point in 1-based indexing. Return -1 if no such point exists.

Example :

Input: 
n = 5 
A[] = {1,3,5,2,2} 
Output: 


Explanation:  
Equilibrium point is at position 3 as sum of elements before it (1+3) = sum of elements after it (2+2). 


Give the problem a try before going through the video. All the best!!!

Problem Link: https://practice.geeksforgeeks.org/problems/equilibrium-point-1587115620/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/2f832734-ab91-4ba5-87d5-def49eb6edad