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

 

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

Write a method that returns an array of integers with all occurances of 'numToDelete' "deleted" from the array. By deleted I mean that those numbers have been replaced by zero, but their positions are still in the array. If 'numToDelete' does not exist anywhere in the original array, return an empty array.


drWhoDeleteNumbers([4, 6, 7, 2, 4, 8, 12], 4) → [0, 6, 7, 2, 0, 8, 12]
drWhoDeleteNumbers([5, 7, 6, 5, 5, 7, 7], 20) → []
drWhoDeleteNumbers([1, 2, 3, 4, 5, 6, 7, 8], 7) → [1, 2, 3, 4, 5, 6, 0, 8]

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

public int[] drWhoDeleteNumbers(int[] nums, int numToDelete) { }

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