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

 

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

Write a method that accepts an array of integers and an "offset" amount, then returns a new array with each element changed by the offset amount. For example, given the array {5,15,-2} and an offset of 100, you would return {105,115,98} because that is what you get when you add 100 to each of the elements in the original array. Look at the test data for further examples.


test2022_01_20_APSLHL_offset([46, 34, 21, 0, 346, -346, 854, -574, -32, 52], 22) → [68, 56, 43, 22, 368, -324, 876, -552, -10, 74]
test2022_01_20_APSLHL_offset([5, 6, 7, 2, 1, -5], 21) → [26, 27, 28, 23, 22, 16]
test2022_01_20_APSLHL_offset([0, -6, 3, -8, 21], 7) → [7, 1, 10, -1, 28]

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

public int[] test2022_01_20_APSLHL_offset(int[] nums, int offsetAmnt) { }

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

Copyright Nick Parlante 2017 - privacy