public class FindNumber {
static String findNumber(List<Integer> arr, int k) {
String res = "YES";
//Unable to identify problem with this part of the code
for (int i = 0; i < arr.size(); i++) {
if (k == arr.get(i))
res = "YES";
else
res = "NO";
}
return res;
}
}
即使整数存在于列表中,上面的代码也会返回 NO 作为答案。
米脂
青春有我
暮色呼如
慕丝7291255
qq_花开花谢_0
相关分类