id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-arrays > apcsaArraysMoreEvens
prev  |  next  |  chance

Given an array of ints, return true if the array contains more elements with even values and false otherwise (same # of even and odd values, or more odd values).

HINT
You can use the remainder operator % to find even and odd values. 5 % 2 == 1, 6 % 2 == 0. (Also -3 % 1 == -1, which you need to watch out for)

apcsaArraysMoreEvens([1, 2, 3, 4]) → false
apcsaArraysMoreEvens([1, 2, 3, 4, 5]) → false
apcsaArraysMoreEvens([-1, 0, 0]) → true

...Save, Compile, Run (ctrl-enter)

public boolean apcsaArraysMoreEvens(int[] nums) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy