Guru_Randhawa's blog

By Guru_Randhawa, history, 5 weeks ago, In English,

Hi, I got this question in the HackWithInfy Round2 and wasn't able to come up with an approach. It would be great if anyone could suggest me the approach to solve this.

Given an integer(n) denoting the no. of particles initially Given an array of sizes of these particles These particles can go into any number of simulations (possibly none) In one simulation two particles combine to give another particle with size as the difference between the size of them (possibly 0). Find the smallest particle that can be formed.

n<=1000

size<=1e9

Example 1:

3

30 10 8

Output

2

Explanation- 10 — 8 is the smallest we can achieve

Example 2:

5

30 27 26 10 6

Output

0

Any help would be appreciated.

 
 
 
 
  • Vote: I like it
  • -5
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Please specify the constraints