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

 

test2021_10_07_SLHL_zeroOnes


Write a method that returns the array 'nums', but with all of the one's 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. Please note that the 'nums' array can be any length, including length zero. Look at the test data for examples.


test2021_10_07_SLHL_zeroOnes([]) → []
test2021_10_07_SLHL_zeroOnes([1]) → [0]
test2021_10_07_SLHL_zeroOnes([23, 431346, 4, 6, 8567, 659, 2463, 985318, 54341, 346, 733, 1532, 7656, 321, 87, 1235, 64, 34]) → [20, 431340, 0, 0, 8560, 650, 2460, 985310, 54340, 340, 730, 1530, 7650, 320, 80, 1230, 60, 30]

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

public int[] test2021_10_07_SLHL_zeroOnes(int nums[]) { }

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