At first I tried to use normal recursion, but because the result tolerates duplicates, the code doesn’t work.

For example, (2*3)-4*5 and 2*3-(4*5) were consider two diff combinations in my original code, but they are not valid combinations. They are the same like (2*3)-(4*5).

Use recursion, for every op, do recursion on left and right separately, then calc all the possible combinations.

Question:

Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return the answer in any order.