Given two integers x and target, return the minimum number of operators required to construct a valid mathematical expression that evaluates to target.
The expression must satisfy the following conditions:
The only operand permitted is x.
The available operators are addition (+), subtraction (-), multiplication (*), and division (/).
Standard operator precedence applies, meaning multiplication and division are evaluated before addition and subtraction.
Parentheses are not permitted.
Division x / x evaluates to
Constraints:
x
target
Given two integers x and target, return the minimum number of operators required to construct a valid mathematical expression that evaluates to target.
The expression must satisfy the following conditions:
The only operand permitted is x.
The available operators are addition (+), subtraction (-), multiplication (*), and division (/).
Standard operator precedence applies, meaning multiplication and division are evaluated before addition and subtraction.
Parentheses are not permitted.
Division x / x evaluates to
Constraints:
x
target