about | help | code help+videos | done | prefs |
Given 2 non-negative ints, a and b, return their sum, so long as the sum has the same number of digits as a. If the sum has more digits than a, just return a without b. (Note: one way to compute the number of digits of a non-negative int n is to convert it to a string with String.valueOf(n) and then check the length of the string.) sumLimit(2, 3) → 5 sumLimit(8, 3) → 8 sumLimit(8, 1) → 9 ...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: 169
Copyright Nick Parlante 2017 - privacy