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

 

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

Write a method that finds the "vampire sum" of an array of numbers. Vampires like to avoid certain numbers at certain times. Given an array of integers called 'num' and a number to avoid called 'avoid', find the sum of all the integers in 'num' but do not include any occurrence of 'avoid'.


oct31_2019_P1SLHL_vampireSum([4, 4, 6, 7, 1, -3, 4], 1) → 22
oct31_2019_P1SLHL_vampireSum([4, 4, 6, 7, 1, -3, 4], 4) → 11
oct31_2019_P1SLHL_vampireSum([7, 1, -5, -3, 2, 2, 2, 2, 5, 7, -14, -1, 3], 2) → 0

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

public int oct31_2019_P1SLHL_vampireSum(int[] nums, int avoid) { }

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

Copyright Nick Parlante 2017 - privacy