about | help | code help+videos | done | prefs |
Given an input array of numbers, add the larger of each pair of values in the array to produce a sum. The first pair is elements with index 0 and 1, the second pair is the elements with values 2 and 3, and so on. Return the sum of each of these larger values. HINTuse Math.max(v1,v2) to find the larger, or just use > and an if/else. apcsaArraysAddLargerOfPair([1, 2, 3, 4, 5, 6]) → 12 apcsaArraysAddLargerOfPair([3, 2, -5, 0]) → 3 apcsaArraysAddLargerOfPair([2, 1]) → 2 ...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: 240
Copyright Nick Parlante 2017 - privacy