about | help | code help+videos | done | prefs |
Write a method that returns the greatest sum of two "adjacent" integers in an array. To be adjacent the two integers must be positioned next to each other in the array. Note that it is possible for the greatest sum to NOT involve the greatest number in the array. For example, the array {4, 5, 70, 3, 40, 35, 2, 1} has a greatest sum of 75. If the array has less than two elements, return zero. Restrictions: You are NOT allowed to use any of the "Math." methods. You are also NOT allowed to use ArrayLists. You are NOT allowed to assume a particular maximum or minimum initial value, not even maxInt or -maxInt!!! bcd1greatestPair([5, 6]) → 11 bcd1greatestPair([2, 3]) → 5 bcd1greatestPair([6]) → 0 ...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: 290
Copyright Nick Parlante 2017 - privacy