Company: Zomato_21july
Difficulty: medium
Count Good Arrays Problem Description An array is considered "good" if the absolute difference between any two consecutive elements is less than or equal to 1. Given an array arr containing elements that are either 0, 1, or 2, or missing (represented by ? ), determine the number of ways to replace the missing elements with arbitrary integer values such that the resulting array is good. Since the result can be large, return the answer modulo (10 9 + 7). Function Description Complete the countGoodArrays function in the editor below. The function is expected to return an INTEGER. The function accepts the following parameters: int arr_count : an integer, the size of arr . int* arr : an array of integers, where missing elements are represented by a specific sentinel value (e.g., -1, or parsed from a character '?' in the input). Returns int : the number of ways to replace missing elements to form a good array, modulo (10 9 + 7). Examples Example 1: Consider n = 3, arr = [0, ?, 1]. There are