Close
Topic list
Beautiful Index
EASY
16 mins
Arrays
Topics (Covered in this problem)
Problem solved
Skill meter
Arrays
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Beautiful Index

Contributed by
Nihal Srivastava
Easy
0/40
Avg time to solve 16 mins
Success Rate 91 %
Share

## Problem Statement

#### For example:

``````Let’s say the array ‘A’ = [1, 3, 1, 5], then if we select index ‘2’, the sum of the prefix is ‘1’, and the sum of the suffix is 1 + 5 = 6. Since the sum is not the same, hence index ‘2’ is not a beautiful index.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input-1
``````2
3
1 1 1
3
1 2 3
``````
##### Sample Output-1
``````2
-1
``````
##### Explanation for Sample Input 1:
``````For test case 1:
Index ‘2’ is the leftmost beautiful index. The left sum is 1 and the right sum is also 1.
For test case 2:
No index is beautiful.
``````
##### Sample Input -2
``````2
6
1 7 3 6 5 6
3
2 1 -1
``````
##### Sample Output -2
``````4
1
``````
Auto
Console