MathWorks logoMathWorks
Coding·85 minMembers

Login Arrays Segment Compression

Members only

Two arrays can be transformed by replacing any contiguous subsegment with its sum. Maximize the length of equal arrays obtainable after any number of such compressions, or return `-1` if impossible.

SWE
array
two-pointer
greedy
medium
Frequency
Single report
Last asked
2025-09-13
Stage
oa

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...