Sunday, August 22, 2010

Setting Element to Zero


An array contains two elements. One is 0 and another one is 1. We don't know the position of 0 or 1. If we cannot do anything other than complement, and assignment. Direct assignment of 0 is not allowed.

Answer:
a[a[1]] = a[a[0]]

No comments:

Post a Comment