gudii9
asked on
sameEnds challenge
Hi,
I am working on below challenge
http://codingbat.com/prob/p131516
I am not clear on challenge desciption and how to approach. please advise
I am working on below challenge
http://codingbat.com/prob/p131516
I am not clear on challenge desciption and how to approach. please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
public String sameEnds(String string) {
String result = "";
int len = string.length();
for (int i = 0; i <= len / 2; i++)
for (int j = len / 2; j < len; j++)
if (string.substring(0, i).equals(string.substring(j)))
result = string.substring(0, i);
return result;
}
above worked fine
At least come up with some code you wrote yourself.
Starting from that we can (try to) help you further.