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

 

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

Write a method that returns the array 'nums' but with all of the negative numbers replaced with a zero. Look at the test data for examples.


test2023_01_19_APP1SLHL_replaceNegs([5, 3, 2, 1, 7, 8, 4]) → [5, 3, 2, 1, 7, 8, 4]
test2023_01_19_APP1SLHL_replaceNegs([-2, 17, -5, 21, 23]) → [0, 17, 0, 21, 23]
test2023_01_19_APP1SLHL_replaceNegs([-1, -2, -3, -4, -5, -6]) → [0, 0, 0, 0, 0, 0]

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

public int[] test2023_01_19_APP1SLHL_replaceNegs(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