educative.io

Incomplete problem statement

Since solution assumes single digit numbers it should state the same in the problem statement.


Type your question above this line.

Course: https://www.educative.io/collection/5668639101419520/5671464854355968
Lesson: https://www.educative.io/collection/page/5668639101419520/5671464854355968/4942401443463168

Hi @Peter_Litvak, the example given was in single digits but this solution is applicable for any digits like single, double, and so on.

I don’t think the way solution is presented will work for more than single digit number.
Looking at the:
char chr = input.charAt(i);
if (!Character.isDigit(chr))
part

Hey @Peter_Litvak, but after breaking the digits we are checking the input whether it is an operator or a digit. We are breaking the equation into two parts and making recursive calls. You can try with double digits input.