Algorithm · Google · Medium
Two integer arrays, a and b, are provided. Each value stands for a distinct object, and no value is repeated inside the same array, although a value may occur in both arrays. Each array imposes ordering rules through its sequence: whenever x is immediately followed by y in one of the arrays, x is required to come before y. Decide whether there is a way to honor the rules coming from both arrays at the same time. If there is not, report false. If there is, report true…