Sum of All Values
Problem Overview
- Given a digit string, insert '+' between characters (no adjacent '+') to form all possible expressions and compute the sum of their values.
- Input: string num of digits; Output: integer equal to the total sum modulo 1e9+7.
- Constraints are unspecified; result may be large, so modulus is required.
- Context: a school scholarship exam in HackerLand focusing on addition expressions.
- A Flexport interviews coding interview problem and common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
