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_SLHL_replaceNegsRunningSum
prev  |  next  |  chance

Write a method that returns the array 'nums' but with all the negative numbers replaced with the sum of all the previous non-negative values in the array. Look at the test data for examples.


test2023_01_19_SLHL_replaceNegsRunningSum([18]) → [18]
test2023_01_19_SLHL_replaceNegsRunningSum([-1]) → [0]
test2023_01_19_SLHL_replaceNegsRunningSum([-220]) → [0]

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

public int[] test2023_01_19_SLHL_replaceNegsRunningSum(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: 250

Copyright Nick Parlante 2017 - privacy