about | help | code help+videos | done | prefs |
mergeChars
BROKEN! NOT WORKING! (There seems to be a problem with char arrays in codingbat) Start with two arrays of chars, a and b, each with its elements in alphabetical order and without duplicates. Return a new array containing the first n elements from the two arrays. The result array should be in alphabetical order and without duplicates. a and b will both have a length which is n or more. The best "linear" solution makes a single pass over A and B, taking advantage of the fact that they are in alphabetical order, copying elements directly to the new array. mergeChars(["a", "c", "e", "g"], ["b", "d", "f", "h"], 4) → ["a", "b", "c", "d"] mergeChars(["a", "c", "z"], ["b", "f", "z"], 3) → ["a", "b", "c"] mergeChars(["a", "c", "z"], ["c", "f", "z"], 3) → ["a", "c", "c"] ...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: 401
Copyright Nick Parlante 2017 - privacy