Created
August 7, 2016 00:14
-
-
Save brendak/d424e64a9e64e77c28c27371260788a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.