Maximum Length Equal Arrays After Segment Merges

You are given two arrays of positive integers, A and B. You may repeatedly perform the following operation on either array:

  • Choose a contiguous subarray and replace all of its elements with...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: