Then, create a method to guess that number. If the position is right, marks "A". otherwise, marks "B". Then, count As and Bs.
For example, the answer is "1234", but guess "1024". Then the result is "2A1B".
With best guessing method (you need to find), and in worst situation, choose the maximum times the method needs to guess any 4 digits-non-repeat numbers.
j.none of above.