Minimum Operations to Make Arrays Equal
Asked at MathWorks · Coding Questions · Difficulty: Hard · Last asked Jul 15, 2026
Given two arrays `source` and `target`, return the minimum number of operations to make the arrays equal. If it is impossible return `-1`. In 1 operation, you can select a prefix or suffix of the array and add `1` to all the elements in the selected subarray.
Loading the problem…