I mean, look at it. You know you want to refactor it. It uses while loop everywhere, and the stack is used to maintain the state which makes the code hard to follow. Also, it uses number to communicate what happen to the caller which is quite error prone (enums would be better).
I mean, look at it. You know you want to refactor it. It uses while loop everywhere, and the stack is used to maintain the state which makes the code hard to follow. Also, it uses number to communicate what happen to the caller which is quite error prone (enums would be better).