Smallest Subarray Max OR

You are given an array nums of length n. For each index i, find the smallest length L such that the subarray starting at i of length L achieves the maximum possible bitwise OR for any subarray starting at i. Return an array of these minimal lengths.

Examples
Input: [1,0,2,1,3]
Output: [3,3,2,2,1]
Hints

Smallest Subarray Max OR

You are given an array nums of length n. For each index i, find the smallest length L such that the subarray starting at i of length L achieves the maximum possible bitwise OR for any subarray starting at i. Return an array of these minimal lengths.