阅读背景:

检查数组中每个值n是否有整数数组,也有一个元素2n, 2n+1, n/2。如果满足,返回1;如果不满足,返回0

来源:互联网 

I appeared in an online test. This is the code I have written which got rejected, what issues do you see? sample inputs are {4,9,8} should give 1 as for 4, 8 is present, for 9, 4 is present, for 8,4 is present. But {3,8,4} should return 0 as because 3 requires either 6,7 or 1 and none of these values are in array. Similarly, {2,2,5,11,23},{7,7,3,6},{0} would return 1 as it satisfies the condition. I have checked for these sample inputs and the code works perfectly for these but I am not being able find why the code was rejected. I may be missing to think something from different perspective. Please help!I appeared in an online test. This is the code




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: