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

Java > String-3 > sameEnds
prev  |  next  |  chance

Given a string, return the longest substring that appears at both the beginning and end of the string without overlapping. For example, sameEnds("abXab") is "ab".

sameEnds("abXYab") → "ab"
sameEnds("xx") → "x"
sameEnds("xxx") → "x"

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  String-3

Forget It! -- delete my code for this problem 321.0

Copyright Nick Parlante 2006-10 - privacy