Given an array of integers, find the smallest window that contains all elements in the array. The window is defined by its start and end indices. If there are multiple windows that contain all elements, return the one with the smallest end index. If no such window exists, return null. For example, if the input array is [1, 2, 3, 4, 5, 6] and the given array is [1, 4, 5], the smallest window is [4, 5]. Constraints: - The input array has a length between 1 and 1000. - The given array has a length between 1 and 10. - All elements in the input array are between 1 and 1000. - All elements in the given array are distinct and between 1 and 1000. Example: Input: [1, 2, 3, 4, 5, 6], [1, 4, 5] Output: [4, 5]
Given an array of integers, find the smallest window that contains all elements in the array. The window is defined by its start and end indices. If there are multiple windows that contain all elements, return the one with the smallest end index. If no such window exists, return null. For example, if the input array is [1, 2, 3, 4, 5, 6] and the given array is [1, 4, 5], the smallest window is [4, 5]. Constraints: - The input array has a length between 1 and 1000. - The given array has a length between 1 and 10. - All elements in the input array are between 1 and 1000. - All elements in the given array are distinct and between 1 and 1000. Example: Input: [1, 2, 3, 4, 5, 6], [1, 4, 5] Output: [4, 5]
Example
Input: [1, 2, 3, 4, 5, 6], [1, 4, 5]
Output: [4, 5]