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

 

jebbert@volusia.k12.fl.us > quiz2023_04_25_HL_strMerge
prev  |  next  |  chance

Write a method that concatenates two strings 'str1' and 'str2' but only include the overlap between the end of 'str1' and the start of 'str2' ONCE. For example, if 'str1' is "abcDEF" and 'str2' is "DEF234", the "DEF" is the overlap of the two strings. The idea is that the two strings can be combined into one string without repeating the overlap. So, the result would be "abcDEF234". You are not eliminating the overlap. You are just including it once. Look at the test data for additional examples. This problem is slightly more difficult that it first appears! Note: If there is NO overlap between the two strings, you simply concatenate the two strings.


quiz2023_04_25_HL_strMerge("abcDEF", "DEF234") → "abcDEF234"
quiz2023_04_25_HL_strMerge("I bet there would be lots of overlap between a normal person talking and Yoda talking", "Yoda talking overlap normal person bet there would be") → "I bet there would be lots of overlap between a normal person talking and Yoda talking overlap normal person bet there would be"
quiz2023_04_25_HL_strMerge("I hope you get the idea here", "I hope you get the idea here") → "I hope you get the idea here"

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

public String quiz2023_04_25_HL_strMerge(String str1, String str2) { }

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

Copyright Nick Parlante 2017 - privacy