Tap here to switch tabs
Problem
Submissions

Problem: Check Array Formation Through Concatenation

med
30 min
Try to solve the Check Array Formation Through Concatenation problem.

Statement

You are given an array of distinct integers arr and an array of integer arrays pieces, where the integers across all elements of pieces are also distinct.

Determine whether you can form arr by concatenating the arrays in pieces in any order. You are not allowed to reorder the integers within any individual array pieces[i].

Return true if it is possible to form arr from pieces, otherwise return false.

Constraints:

  • 1≤1 \leq pieces.length ≤\leq arr.length ≤100\leq 100

  • sum(pieces[i].length) == arr.length

  • 1≤1 \leq pieces[i].length ≤\leq arr.length

  • 1≤1 \leq arr[i], pieces[i][j] ≤100\leq 100

  • The integers in arr are distinct.

  • The integers in pieces are distinct (i.e., if pieces is flattened into a 11D array, all integers in the resulting array are distinct).

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check Array Formation Through Concatenation

med
30 min
Try to solve the Check Array Formation Through Concatenation problem.

Statement

You are given an array of distinct integers arr and an array of integer arrays pieces, where the integers across all elements of pieces are also distinct.

Determine whether you can form arr by concatenating the arrays in pieces in any order. You are not allowed to reorder the integers within any individual array pieces[i].

Return true if it is possible to form arr from pieces, otherwise return false.

Constraints:

  • 1≤1 \leq pieces.length ≤\leq arr.length ≤100\leq 100

  • sum(pieces[i].length) == arr.length

  • 1≤1 \leq pieces[i].length ≤\leq arr.length

  • 1≤1 \leq arr[i], pieces[i][j] ≤100\leq 100

  • The integers in arr are distinct.

  • The integers in pieces are distinct (i.e., if pieces is flattened into a 11D array, all integers in the resulting array are distinct).