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

 

tmhscs@gmail.com arrays > array_fivesDisappear
prev  |  next  |  chance

Given an integer array "a", return an array with the same values as "a" but without any values of 5. To remove an element from an array, you cannot use .remove() (that is for ArrayLists). First, create a new array with the correct final length. Then, fill it up with all of the non-5 values from "a". Finally, return that new array.


array_fivesDisappear([3, 4, 5]) → [3, 4]
array_fivesDisappear([5, 4, 3]) → [4, 3]
array_fivesDisappear([5, 5, 1, 5, 5]) → [1]

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

public int[] array_fivesDisappear(int[] a) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy