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

 

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

Write a method that accepts an array of numbers and a specific number to be removed from the array. Return a new array of the same length, but with the 'remove' number removed from the array. Shift all the other numbers over, and place zeros at the end of the array for each removed number. Look at the test data for clarification.


cedarEliminateNums([16, 4], 4) → [16, 0]
cedarEliminateNums([4, 5, 6, 6, 5, 4, 1], 6) → [4, 5, 5, 4, 1, 0, 0]
cedarEliminateNums([17, 17, 17, 3, 167, 17, 4], 17) → [3, 167, 4, 0, 0, 0, 0]

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

public int[] cedarEliminateNums(int[] nums, int remove) { }

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