Company: Harness_21nov
Difficulty: medium
Student Arrangement Problem Description Numbers must be assigned to classmates represented in an array. An arrangement is considered good if the absolute difference between any two adjacent students is at most 1. The input array contains some missing elements marked as 0. Your task is to find the total number of ways to replace these missing elements with arbitrary integers to form a good array. Since the answer can be large, return it modulo 10^9 + 7. Examples Example 1: Input: arr = [0, 0, 1] Output: 9 Explanation: There are 9 ways to replace the zeros to make the array good: [0, 0, 1] [1, 2, 1] [1, 0, 1] [0, 1, 1] [1, 1, 1] [2, 1, 1] [-1, 0, 1] [2, 2, 1] [3, 2, 1] In each case, the absolute difference between consecutive elements is at most 1. Example 2: Input: arr = [0, 1, 1, 0] Output: 9 Explanation: The valid arrays are: [0, 1, 1, 0] [1, 1, 1, 0] [2, 1, 1, 0] [0, 1, 1, 1] [1, 1, 1, 1] [2, 1, 1, 1] [0, 1, 1, 2] [1, 1, 1, 2] [2, 1, 1, 2] In each of these arrays, the absolute differ