Hi to all,
I must to make a program in java.
The problem is this:
We have 2 players: player A and player B.
Player A think a numbers, and says to player B the crowd of digit of the number that he thought.
Player B says to player A numbers which have those digits that player A said to him.
Then, player A says to player B two numbers the first one says how many digits in the number that player B told is matching with the number that player A thought, and the other one says how many digits that player B told there are in number that player A thought, but it's not in the correct position.
I must to write a program which takes from input the crowd of digit of the number that player A thought, phases of the game and returns the smaller number that satisfies the conditions.
For example with this input
3157 1 2
1350 2 1
6120 0 2
2381 3 0
the first 4 is the crowd of digit that A thought.
the second 4 is the crowd of phases....
Another example 7 0 output: 0000000
If there are no solution the output of program must be "-1"
The program must be in Java...
There are strictly test-cases and for this reason the program must be efficient...
Break the big problem down into small sub problems and start working on creating classes, fields and methods that solve the small problems one at a time. Do not move on to the next step until the current step has been solved and the current code compiles OK. Please have a look at the links in my signature, especially the last one "so you need to write a program..."
Originally Posted by papinhio
If you need more specific help, and get stuck at a particular step, please feel free to ask a more specific question and show your code as best you can (also see my signature link on code tags).
Also moving to the new to Java forum for closer topic alignment.
If anyone can gives me any efficient algorithm..
That's the first step i thinkk!