about | help | code help+videos | done | prefs |
Write a recursive method named mergeDigitPairs that accepts an integer parameter n and returns the integer formed by combining each pair of digits from n into a single digit that is their sum. For example, if passed the number 1234, you should combine the digits 12 into 1+2 or 3, and combine the digits 34 into 3+4 or 7, leading to a returned result of 37. mergeDigitPairs(1234) → 37 mergeDigitPairs(3186507) → 3927 mergeDigitPairs(-52874) → -512 ...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: 200
Copyright Nick Parlante 2017 - privacy