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

 

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

Write a method that returns the sum of all the integers in 'nums', except exclude all values between 'lower' and 'upper', inclusive. For example, if 'lower'=15 and 'upper'=30, you would exclude all the integers from 15 to 30 inclusive from the sum. So 15, 16, 17, ... 29, 30 would all be excluded from the sum. Return the sum of all the number that were not excluded. Notes: The array can be any length, including zero. There might not be any numbers in the excluded range. In that case you include all the numbers in the sum.


test2022_04_21_APSLHL_sumExclusingBetween([5, 15, 25, 35, 45, 55], 20, 40) → 120
test2022_04_21_APSLHL_sumExclusingBetween([700, 500, 400, 300, 220, 110, 50, 40, 20], 111, 219) → 2340
test2022_04_21_APSLHL_sumExclusingBetween([24, 235, 346, 453, 25, 36, 56, 6, 8763, 745, 124], 100, 235) → 10454

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

public int test2022_04_21_APSLHL_sumExclusingBetween(int[] nums, int lower, int upper) { }

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