Check Array Formation Through Concatenation
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given an array arr of distinct integers and an array of integer arrays pieces, where all integers across all pieces are also distinct.
You want to build arr by concatenating every piece exactly once, in any order you like, but you may not rearrange the integers inside a piece. Return true if this is possible and false otherwise.
Examples
Constraints
- 1 <= pieces.length <= arr.length <= 100
- sum(pieces[i].length) == arr.length
- 1 <= pieces[i].length <= arr.length
- 1 <= arr[i], pieces[i][j] <= 100
- The integers in `arr` are distinct, and the integers across all of `pieces` are distinct
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.