## Problem:

Given an array of ints, return true if the number of 1's is greater than the number of 4's

more14({1, 4, 1}) → true
more14({1, 4, 1, 4}) → false
more14({1, 1}) → true

## Solution:

public boolean more14(int[] nums) {
int count1 = 0;
int count4 = 0;
boolean isTrue = false;

for (int i = 0; i < nums.length; i++) {
if (nums[i] == 1)
count1++;
if (nums[i] == 4)
count4++;
}

if (count1 > count4)
isTrue = true;

return isTrue;

}

1. public boolean more14(int[] nums) {
boolean result = true;
int zero = 0;
for (int i=0; i0) ? true : false;
return result;
}

2. Not sure why the formatting screwed up on previous comment...

> public boolean more14(int[] nums) {
> boolean result = true;
> int zero = 0;
> for (int i=0; i < nums.length; i++)
> zero = (nums[i]==1) ? zero+1 : (nums[i]==4) ? zero-1 : zero;
> result = (zero>0) ? true : false;
> return result;
> }

3. public boolean more14(int[] nums) {
int count = 0;

for (int i=0; i 0) return true;

return false;
}

4. public boolean more14(int[] nums) {

int count1 = 0, count4 = 0;

for(int i = 0; i < nums.length; i++) {

if(nums[i] == 1) count1++;
if(nums[i] == 4) count4++;

} return count1 > count4;

}

5. public boolean more14(int[] nums) {

int c1=0,c4=0;
for (int i=0; ic4 ? true:false;
}

6. public boolean more14(int[] nums) {
int one = 0;
int four = 0;

for(int i = 0; i < nums.length; i++){
if(nums[i] == 1){
one++;
} else if(nums[i] == 4){
four++;
}
}

if(one > four){
return true;
} else {
return false;
}

}