long long func(int num)
{
if(num<12) return num;
if(num<=10000000&&r[num]!=-1) return r[num];
this is the snippet from second one(wrong one)
I just change (-1) to 0 and it gives correct answer why ? (only change)
Does long long not support negative values ?
@bugkiller! You have got it wrong in the comment. Let me use more general terms to correct it:
arr[siz] = {a1, a2, a3, ..., an} sets the first n elements of arr as the values specified, and all the remaining siz - n elements as zero (not garbage).
Here, siz must be at least as large as n. Otherwise compiler will throw an error. So,