In String 1 section of Java Bat there are basic string problems in which you cannot use loops to solve the problem. We should use string functions like str.length(), str.substring(i,j) etc.
Extra End Problem : Given a string, return a new string made of 3 copies of the last 2 chars of the original string. The string length will be at least 2.
Examples:
extraEnd("Hello") → "lololo"
extraEnd("ab") → "ababab"
extraEnd("Hi") → "HiHiHi"
Solution for this JavaBat extraEnd problem:
Extra End Problem : Given a string, return a new string made of 3 copies of the last 2 chars of the original string. The string length will be at least 2.
Examples:
extraEnd("Hello") → "lololo"
extraEnd("ab") → "ababab"
extraEnd("Hi") → "HiHiHi"
Solution for this JavaBat extraEnd problem:
public String extraEnd(String str) { |
Thnx 4 al tha cobes it rly help me wif cumpoter cience. I blame Obama and wan mo help. Congratulatiounes on the blogd.
ReplyDeleteI now much bout the unevurse but this place is my fav
Deletehoo did thes I wil phind them
Deletereally helpful. I'm taking a DukeU class through Coursera and this is the perfect compliment to fill in the gaps of my understanding.
ReplyDelete