Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@brendak
Created August 7, 2016 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendak/d424e64a9e64e77c28c27371260788a5 to your computer and use it in GitHub Desktop.
Save brendak/d424e64a9e64e77c28c27371260788a5 to your computer and use it in GitHub Desktop.
function isMerge(s, part1, part2){
var combined = part1.concat(part2);
var alphaed = combined.split('').sort('').join('');
var ss = s.split('').sort('').join('');
if (ss == alphaed){
return true;
}
return false;
}
@brendak
Copy link
Author

brendak commented Aug 7, 2016

Instructions

At a job interview, you are challenged to write an algorithm to check if a given string, s, can be formed from two other strings, part1 and part2.

The restriction is that the characters in part1 and part2 are in the same order as in s.

The interviewer gives you the following example and tells you to figure out the rest from the given test cases.

@azlan
Copy link

azlan commented Aug 7, 2016

what are those test cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment