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

 

jebbert@volusia.k12.fl.us > sliceSum
prev  |  next  |  chance

Write a method that accepts two arrays of non-negative integers. The method returns the sum of all of the integers in the two arrays with the following exceptions: #1 Do not count any EVEN numbers that have the same value in the same location in both arrays. For example, if both arrays have a 6 in the third position then neither of those count towards the sum. #2 Do not count any numbers that do not have a matching position in the other array. So if one array is 3 numbers long and the other array is 100 numbers long, only the first three numbers from the second array would count, provided they did not violate rule #1 above.


sliceSum([], []) → 0
sliceSum([5, 2, 3, -24], []) → 0
sliceSum([10], [20]) → 30

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

public int sliceSum(int[] nums1, int[] nums2) { }

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: 280

Copyright Nick Parlante 2017 - privacy