find two largest number in array and take their difference. if difference is not present in arry then add it to array. repeat this process untill one element or zero element remaining. return remaining element.
Sigiloso
by priority queue data structure