Help, I dreamed of a problem that I can't solve

Revision en1, by GomerDoGo, 2026-04-20 18:02:11

So, I was sleeping and this problem just came to me in a dream:

Given an array a and an array b, we need to split a into contiguous subsegments and for each subsegment assign 1/0 — whether we reverse it or not. The question: can we determine if it's possible to obtain b from a?

So far I only know how to solve it in O(n²), but there's clearly a better way, help pls

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru2 Russian GomerDoGo 2026-04-20 18:05:22 2
ru1 Russian GomerDoGo 2026-04-20 18:05:07 397 Первая редакция перевода на Русский
en1 English GomerDoGo 2026-04-20 18:02:11 442 Initial revision (published)