Help with developing algorithm
Hello all!
I am currently studying java in one of my engineering classes and received this project on an assignment. I was wondering if anyone would be able to help me out. Any help would be useful.
Thanks a lot!
Question:
Write a program that takes as input a numeric string (i.e. a string that consists only of the numeric digits 0 through 9) and uses recursion to answer the following problem: is there any way to add mathematical operators into the string such that the result is a valid mathematical equation?
The following strings have valid solutions:
"2317" (solution: "2*3+1=7")
"05555" (solution: "0*5*5+5=5")
"2284" (solution: "2*2=8-4")
"11112" (solution "1+11=12")
"123123" (solution: "123=123")
The following operators are valid (and have standard meaning): "+", "*", "/", "-", "%", "=". Integer division should be used for the "/" operator. Negative numbers are not allowed (so given the string "143", "-1+4=3" is not a valid solution). The "=" can only appear once in a valid solution (note that both "1*1=1" and "1=1*1" are valid solutions to the string "111"). Lastly, you may assume "left-to-right" arithmetic operations (i.e. 1+4*2-7 equals 3, since proceeding from left to right we first perform the addition, then the multiplication, then the subtraction).
Your program should take the user's input, print out whether or not the string has any valid solutions, and print out (any) valid solution if one exists.

