Modify a given number to find the required sum?

Posted by Gaurav on Stack Overflow See other posts from Stack Overflow or by Gaurav
Published on 2011-01-01T10:12:33Z Indexed on 2011/01/01 10:53 UTC
Read the original article Hit count: 253

Filed under:
|
|
|
|

A friend of mine sent me this question. I haven't really been able to come up with any kind of algorithm to solve this problem.

You are provided with a no. say 123456789 and two operators * and +. Now without changing the sequence of the provided no. and using these operators as many times as you wish, evaluate the given value:

eg: given value 2097
Solution: 1+2+345*6+7+8+9

Any ideas on how to approach problems like these?

© Stack Overflow or respective owner

Related posts about c

    Related posts about algorithm