public boolean sameEnds(int[] nums, int len) {
boolean res = true;
for(int i = 0; i<len; i++){
for(int j = nums.length-len; j<nums.length; j++){
if(nums[i]!=nums[j]){
res = false;
}
}
}
return res;
}
Can someone please explain why my code is false? I can't figure it out. Thank you!
Aucun commentaire:
Enregistrer un commentaire