N
N
Natalia2019-03-27 09:04:12
Java
Natalia, 2019-03-27 09:04:12

How to insert +-/* and brackets into a sheet containing a set of numbers?

Hello. Please help me write an algorithm for inserting -+*/ and brackets into a sheet with 4 digits. I found that there will be 3 ^ 3 possible combinations of inserting these characters (I haven’t considered brackets yet) (that is, there are 3 possible places for inserting mathematical signs between 4 digits).
But I can not figure out how to go through the cycle, substituting characters in the sheet. It turns out to insert only 1 type of sign in each possible place, and it is impossible to sort through all possible values. I write in java, or rather, I'm just learning.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2019-03-27
Hasanly @azerphoenix

Just a couple of days ago there was a similar question - Problem with brackets))))))?
And there were some good ideas that you can use

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question