Given an array of positive integers nums, find the smallest balanced index i.
An index i is defined as balanced if the sum of all elements strictly to the left of i is equal to the product of all elements strictly to the right of i.
Return the smallest balanced index i. If no balanced index exists, return
Note: The sum of elements to the left of index
is considered to be , and the product of elements to the right of the last index is considered to be .
Constraints:
nums.length
nums[i]
Given an array of positive integers nums, find the smallest balanced index i.
An index i is defined as balanced if the sum of all elements strictly to the left of i is equal to the product of all elements strictly to the right of i.
Return the smallest balanced index i. If no balanced index exists, return
Note: The sum of elements to the left of index
is considered to be , and the product of elements to the right of the last index is considered to be .
Constraints:
nums.length
nums[i]