 New update is available. Click here to update.

# Magnet Array Problem

Posted: 1 Mar, 2021
Difficulty: Easy

## PROBLEM STATEMENT

#### Note :

``````An equilibrium point is a point where net force is 0 i.e repulsive force of left side magnets is equal to the repulsive force of right side magnets.

If there are N magnets, then there will be N - 1 equilibrium points.

The array “ARR” which denotes the positions of the magnets is in a sorted fashion.
``````
##### For example :
``````If ARR = {1, 3} , then the output will be 2.

Explanation: For two points, the mid-point will have a net force of 0 because the distance from the mid-point will be equal.
``````
##### Input Format :
``````The first line contains an integer ‘T’ which denotes the number of test cases or queries to be run. Then the test cases are as follows.

The first line of each test case contains an integer ‘N’ which denotes the number of magnets.

The second line of each test case contains ‘N’ space-separated integers denoting the positions of the magnets on the x-axis.
``````
##### Output Format :
``````For each test case, print all the positions of zero net force with accuracy up to 3 decimal points.

Print the output of each test case in a separate line.
``````
##### Constraints :
``````1 <= T <= 100
2 <= N <= 1000
0 <= ARR[i] <= 10000

Time Limit: 1 sec
``````
##### Note :
``````You do not need to print anything. It has already been taken care of. Just implement the given function.
``````
SIMILAR PROBLEMS

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022
Difficulty: Moderate

Maximum GCD

Posted: 8 Dec, 2022
Difficulty: Hard

Prime?

Posted: 9 Dec, 2022
Difficulty: Easy

Co-Prime

Posted: 14 Dec, 2022
Difficulty: Hard

Negative To The End

Posted: 16 Dec, 2022
Difficulty: Easy