I got to know how to solve the puzzle.

We need to find the sum of elements encovered by the outer array.
And once we enter the elemnets, whenever we find an element enclosed by [x]
we shoudl take that as  -x for the summation.
For example:
[ 9, [ 3, 4, [ [ 2 ] ] ] ]   =  0

In this case we need to fnid the sum of
9, [3,4, [[2]]]

So if we look at it in the equation format
9+ (-(3+4+ -(-(2))))

i.e 9+ (-(3+4+2))
= 9+ (-(9))
= 9-9
 = 0
:)
There we go
thats the puzzle

Ubuntu,

Coming to it's implementation using Perl.

How exactly are you planning to give the puzzle to the program?

Is it in text?

Or is it in an Array format?

My guess is "text".

Please confirm

Thanks,
Harinatha

Reply via email to