# nums[i]!=1 nums[i]!=4 nums[i]!=1||nums[i]!=4

1 F T T

2 T T T

3 T T T

4 T F T

5 T T T

```
if(nums[i]!=1||nums[i]!=4){
```

Having return statement within the loop will return the result before checking all the numbers.

This one is kinda hard to explain so try to understand the below code. Two variables are needed to track the absence of 1 and 4 separately. If only one variable is used we can change the variable to false if 1 is found. But it maybe the case that no 4's are present in which case it should return true.

```
public boolean no14(int[] nums) {
boolean no1=true, no4=true;
for(int i=0;i<nums.length;i++){
if(nums[i]==1)
no1=false; // it contains 1's, so it contains no 1's is false
else if(nums[i]==4)
no4=false; // it contains 4's, so it contains no 4's is false
}
return no1||no4; // return true if it contains no 1's or it contains no 4's.
}
```