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

 

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

Write a method that returns the array 'nums', but with all of the digits in the 'place' places replaced with a zero. You may NOT use strings of any kind! As a precondition, you may assume that all of the elements of 'nums' are positive. You may also assume that 'place' will be a positive power of 10 (1, 10, 100, 1000, etc.). Please note that the 'nums' array can be any length, including length zero. Look at the test data for examples.


test2021_10_07_HL_zeroInPlace([], 100) → []
test2021_10_07_HL_zeroInPlace([1], 1) → [0]
test2021_10_07_HL_zeroInPlace([1234987], 100) → [1234087]

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

public int[] test2021_10_07_HL_zeroInPlace(int nums[], int place) { }

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: 290

Copyright Nick Parlante 2017 - privacy