Your question is Target From Number String. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Veeva Vault configuration data can encode numeric expressions as a single digit string. Given a string of digits and a target integer, split the string into exactly three nonempty numbers without changing digit order, insert one operator between adjacent numbers, and return an equation that evaluates to the target.
Allowed operators are +, -, and *. Multiplication follows normal arithmetic precedence. A number may not contain leading zeroes unless it is exactly 0. Return any valid equation as a string in the form a<op1>b<op2>c=target. Return None if no valid equation exists. The function should not print directly, which makes the result easier to test.
digits, a string containing only characters from 0 through 9, and target, an integer.None when no solution exists.digits.0 through 90None if no equation existsdef build_expression(digits, target):