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

 

sameParity


Two non-negative integers have the same "parity" if both are even, or if both are odd. Return true if all the numbers in an array have the same parity. For example, in the array {4, 7, 0, 19}, there is a mix of evens and odds, and so you would return false.


sameParity([4, 7, 0, 19]) → false
sameParity([0, 10, 2, 16, 8]) → true
sameParity([11, 13, 999]) → true

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

boolean sameParity(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: 200

Copyright Nick Parlante 2017 - privacy