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

 

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

Write a method that has two integer arrays as input parameters. Return the sum of the first array, excluding any of the numbers in the first array that appear in the second array. So the second array is a list of numbers to exclude when calculating the sum. For example: sumExcludingSLAPHL_Dec2011({5,7,3,4,7}, {3,7}) returns 9 since 5+4=9. It does NOT count the 7, 3, or 7 since those matched numbers in the exclusion array.


sumExcludingSLAPHL_Dec2011([4, -2, -3, 6, -3, 7, 3, 1], [-3]) → 19
sumExcludingSLAPHL_Dec2011([4], [4]) → 0
sumExcludingSLAPHL_Dec2011([5, 7], [4, 6, 8]) → 12

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

public int sumExcludingSLAPHL_Dec2011(int[] numsToAdd, int[] exclusions) { }

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

Copyright Nick Parlante 2017 - privacy