about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy