Java is the future !: front3

Sunday, October 10, 2010


You've given a string, the chankey is the first 3 chars of the string. If the string length is less than 3, the chankey is whatever is there. Return a new string which is 3 copies of the chankey.

front3("Metallica") → "MetMetMet"
front3("Coldplay") → "ColColCol"
front3("No") → "NoNoNo"

Solution :

No comments:

Post a Comment