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

 

apcsaListReplaceZeros


Given an ArrayList of Integers lst and a number num, replace all the zero entries in lst with num. Return the ArrayList.


apcsaListReplaceZeros([0, 5], 3) → [3, 5]
apcsaListReplaceZeros([5, 0, 3, 2, 0], -10) → [5, -10, 3, 2, -10]
apcsaListReplaceZeros([2, 32, 33, 0], 1) → [2, 32, 33, 1]

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

public ArrayList<Integer> apcsaListReplaceZeros(ArrayList<Integer> lst, int num) { }

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