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

 

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

Write a method that accepts two identical length arrays of integers 'nums1' and 'nums2' and returns a new array that contains the sum of the corresponding elements of those arrays. What this means is that the i-th element of the resulting array is the sum of the i-th element in 'nums1' and the i-th element in 'nums2'. Preconditions: You may assume that 'nums1' and 'nums2' are the same length (which could be zero). Look at the test data for examples.


test2023_12_07_APP1SLHL_combineSum([-5, 2], [5, -2]) → [0, 0]
test2023_12_07_APP1SLHL_combineSum([5, 10, 20, -8, -4, -1], [3, 1, -10, 9, 5, 2]) → [8, 11, 10, 1, 1, 1]
test2023_12_07_APP1SLHL_combineSum([53, 2, 325, 75, -35, -46, 25, 12, 9, 55, 200, 23], [53, 2, 325, 75, -35, -46, 25, 12, 9, 55, 200, 23]) → [106, 4, 650, 150, -70, -92, 50, 24, 18, 110, 400, 46]

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

public int[] test2023_12_07_APP1SLHL_combineSum(int[] nums1, int[] nums2) { }

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