Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make Array Equal to Target

Try to solve the Minimum Operations to Make Array Equal to Target problem.

Statement

You are given two integer arrays nums and target of equal length.

In a single operation, you can choose any contiguous subarray of nums and increment or decrement all values within that subarray by 11.

Return the minimum number of operations needed to transform nums into target.

Constraints:

  • 1≤1 \leq nums.length == target.length ≤105\leq 10^5

  • 1≤1 \leq nums[i], target[i] ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make Array Equal to Target

Try to solve the Minimum Operations to Make Array Equal to Target problem.

Statement

You are given two integer arrays nums and target of equal length.

In a single operation, you can choose any contiguous subarray of nums and increment or decrement all values within that subarray by 11.

Return the minimum number of operations needed to transform nums into target.

Constraints:

  • 1≤1 \leq nums.length == target.length ≤105\leq 10^5

  • 1≤1 \leq nums[i], target[i] ≤108\leq 10^8