@mohan, when the num of repeatation is bigger than 1, it may be wrong,please
check {1, 1, 2, 5, 6, 6}
On Fri, Dec 10, 2010 at 12:41 PM, mo...@ismu mohan...@gmail.com wrote:
i did nt get this xor part in adithya solution
check if this works
array is valid if satisfy 2 conditions
you mean the function qsort() in crt?
here is a sample
struct foostruct{
int key;
int value1;
int value2;
};
int compare(const void* a1, const void* a2){
return ((foostruct*)a1)-key - ((const foostruct*)a2)-key;
}
void bar(){
foostruct s[] ={ {3, 2, 3}, {5, 2, 1}, {2, 6, 5} };
qsort(s,
@anoop
in fact, it always work even if there are repeated elements, because they
don't change the decision.
in detail, assume ii, ,jj, kk is one of the answers, then a[ii]+a[jj]=a[kk].
since the array is sorted, so a[ii-1]+a[jj] = a[kk] and a[ii] + a[jj+1] =
a[kk].
so when you try the pair of
@anoop
when you find some i and j(i j) meet the condition i.e. asq[i] + asq[j] ==
asq[k], you can merge the same value without rollback.
in this sense, you are right.
On Thu, Dec 2, 2010 at 2:26 PM, anoop chaurasiya anoopchaurasi...@gmail.com
wrote:
@fenghuang try this array