about | help | code help+videos | done | prefs |
Write a method that returns the "interlace" of two input parameter strings. The "interlace" of two strings is a string equal in length to the shorter of the two strings, where characters that match in the same position are kept while non-matching characters are replaced with a "-". So if the input strings are "abcd" and "acbdxyz" you would return "a--d". Look at the test data for additional examples. The only string methods you are allowed to use are .equals, .charAt, .substring, and .length. nov20_2015_SLHL_interlaceStrings("a man a plan a canal panama", "amanap lanac a nalp a nam a") → "a---------a- a -a---------a" nov20_2015_SLHL_interlaceStrings("dad", "dad") → "dad" nov20_2015_SLHL_interlaceStrings("jump", "down") → "----" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy