1640. Check Array Formation Through Concatenation - Day 1/31 Leetcode January Challenge

preview_player
Показать описание
Larry solves and analyzes this Leetcode problem as both an interviewer and an interviewee. This is a live recording of a real engineer solving a problem live - no cuts or edits!

#leetcode #coding #programming
Рекомендации по теме
Комментарии
Автор

Happy New Year! Hope y'all have a great year!

Algorithmist
Автор

Interesting approach, my first idea was to have a lookup of the indexes in arr and then iterate over pieces and check if the invariant of the order is true

nadavkaner
Автор

Hey Larry! Thank you so much for the explanation! quick question about your comment at the end - you mention it is possible to solve this in O(1) space. Is that true? Even if you change your map to point to the index in pieces, in the worst case pieces might have N arrays of size 1, which means you'll have to store N entries in the map.

barakj
join shbcf.ru