make all elements 0 in an array
Given an array of two elements having value 0 and 1, Make both elements 0, specifications : i) it is guaranted that one element is 0 but we do not know its position. ii) we can’t say about another element it can be 0 or 1. iii) we can only complement the element. iv) no other operation is allowed (and, or, multi, division…. etc.)
a[a[1]]=a[!a[1]];
ReplyDeletedo we even need the complement?
ReplyDeletea[a[1]]=0
@jainendra you are right...:)
ReplyDelete