Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *. Example 1: Input: "2-1-1" Output: [0, 2] Explanation: ((2-1)-…
public class Solution { public IList<int> DiffWaysToCompute(string input) { List<int> ret = new List<int>(); ; i < input.Length; i++) { if (input[i] == '-' || input[i] == '*' || input[i] == '+') { , i); ); var part1Ret = DiffWaysToCom…
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are+, - and *. Example 1 Input: "2-1-1". ((2-1)-1) = 0 (2-(1-1)) = 2 Output: …