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

 

mmiller@cacegypt.org cigol-1 > rikken
prev  |  next  |  chance

Rikken have various numbers of limbs and are usually found in pairs. Rikken a will only pair with rikken b when the sum of their limbs has the same number of digits as a. For a given rikken (a) and a potential pair (b), return the sum of their limbs if a will pair with b, otherwise 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.)


rikken(2, 3) → 5
rikken(8, 3) → 8
rikken(8, 1) → 9

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

public int rikken(int a, int b) { }

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: 175

Copyright Nick Parlante 2017 - privacy