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

 

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

Write a method that returns the sum of all the integers in the input parameter array 'nums', except do NOT include any numbers that contain the 'excludeDigit'. As preconditions, you may assume that 'nums' only contains positive integers and that 'excludeDigit' is a single digit 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. You don't just exclude the DIGIT from the sum. You exclude ANY number that contains that digit. Look at the test data for examples. You may NOT use ANY strings or maps.


quiz2022_03_23_APSLHL_sumExcluding([1, 2, 3, 4, 5, 6, 7, 8, 9], 5) → 40
quiz2022_03_23_APSLHL_sumExcluding([634, 2346, 554, 54, 34151, 134, 3462, 547337, 56356, 23, 553, 4326, 55, 75, 5432, 4362, 2346643, 7575, 43, 56, 5654643, 32235, 5454, 463, 3523, 756, 43464, 36, 364], 3) → 14579
quiz2022_03_23_APSLHL_sumExcluding([23, 46, 765, 865, 7689, 124], 2) → 9365

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

public int quiz2022_03_23_APSLHL_sumExcluding(int[] nums, int excludeDigit) { }

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