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

 

sspiege3@schools.nyc.gov arrays4.d > collapse
prev  |  next  |  chance

This method returns a new array containing the result of replacing each pair of integers with the sum of that pair. Assume the array has an even amount of values.


collapse([7, 2, 8, 9, 4, 13, 7, 1, 9, 10]) → [9, 17, 17, 8, 19]
collapse([1, 2, 3, 4, 5, 6]) → [3, 7, 11]
collapse([0, 0, 0, 0]) → [0, 0]

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

public int[] collapse(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: 201 Post-solution available

Copyright Nick Parlante 2017 - privacy