Power of Army

kazi_nayeem NEUB Junior Inter Univers...
Limits 1s, 512 MB

Recently Chikanu declared war against Shukanu. To win the battle against Shukanu he wants to form an Army. As he wants to form a powerful Army, he needs a lot of soldiers.His best friend Thikanu will help him to find soldiers for his army. However, to fight against Shukanu, Chikanu needs a very powerful army. Before going to the battlefield Chikanu wants to measure the power of his army formed by NN soldiers.

Chikanu measures the power of his Army using the height of all soldiers. He defines the difference of height between the tallest soldier and the shortest soldier as the power of Army.

You will be given the height of all NN soldiers. You will have to output the power of Chikanu’s Army.


First line contains an integer TT, denotes the number of test cases.

First line of each test case contains an integer NN, denotes the number of soldiers.

Following line contains NN integers. ii-th integer of this line represents the height of the ii-th solder and the height of a soldier is a positive integer less than or equal to 100000.


1T1001 \le T \le 100
2N10002 \le N \le 1000


For each test case, print the power of the Army in a separate line.


2 4 5 3 2


Login to submit.



92% Solution Ratio
kamran_11bEarliest, Jan '18
steinumFastest, 0.0s
abuhuraira071Lightest, 0 B
bokaifShortest, 78B
Toph uses cookies. By continuing you agree to our Cookie Policy.