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

 

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

Write a method that accepts an array of integers and returns the same array but with all of the negative elements replaced with the opposite value.


arrayAbs([5, -3, 6, -7]) → [5, 3, 6, 7]
arrayAbs([0, -2, -4, -8]) → [0, 2, 4, 8]
arrayAbs([9, -4, -5, 6, 0]) → [9, 4, 5, 6, 0]

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

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