Check Array Formation Through Concatenation (LeetCode 1640)

(at edit #0)

Markdown 100.0%

lc1640.md

Markdowncopyraw

Check Array Formation Through Concatenation (LeetCode 1640)

Goal

Can pieces be concatenated (no reordering inside) to form arr?

Approach

Map first element of each piece to the piece, then walk arr matching pieces.

Tip

Distinct values make the hash-map lookup safe; say so.

Prep notes shared by the Linkjob AI team. Practice explaining solutions out loud with learn more.

created at:

stats: 13 lines, 63 words, 413b