Company: Service now_26oct
Difficulty: medium
Array Nullification Problem Description You are given two arrays, change and arr , of lengths n and m respectively. In each operation, you can perform one of the following: 1. You can decrement any element of arr by 1. 2. If change[i] = 0 and arr[change[i]] > 0 , you can change that element to NULL . Assume 1-based indexing and find the minimum number of operations required to change all elements of the array to NULL , or report -1 if not possible. Complete the function getMinOperations in the editor with the following parameter(s): int getMinOperations(vector change, vector arr) change : an array of integers of length n . arr : an array of integers of length m . Examples Example 1: Input: n = 4, m = 2 change = [0, 1, 0, 2] arr = [1, 1] Output: 4 Explanation: One possible operation sequence: Decrement arr[1] to 0. arr becomes [0, 1] . Change arr[1] to NULL since change[2] = 1 and arr[1] = 0 . arr becomes [NULL, 1] . Decrement arr[2] to 0. arr becomes [NULL, 0] . Change arr[2] to NULL s