All Possible Combination

Given four numbers(say 1,2,3,6). How Can we generate all possible combinations using addition,subtraction,multiplication,division and brackets.

I have found a similar problem: Free Parentheses (ACM ICPC Jakarta 2008 LA 4143)
please help…

Hi, sorry i haven’t really tried solving your problem but on googling i found this:


It’s a huge document go to page number 52 according to original numbering or page number 64 of the pdf or simple use CTRL+F and search for “free parenthesis”:wink:

This problem is listed under dynamic programming and it has been explained nicely with a pseudo-code so you can have a look

Hope this helps! :slight_smile:

1 Like