Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Different Ways to Add Parentheses

Given an expression of digits and the operators + - *, print every possible result of computing it by grouping numbers and operators in all possible ways, sorted ascending (duplicates kept).

Constraints

1 <= len(expression) <= 20 Numbers are in [0, 99]

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.