Skip to content

Commit 1556161

Browse files
refactor 299
1 parent 2572788 commit 1556161

File tree

1 file changed

+0
-22
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-22
lines changed

src/main/java/com/fishercoder/solutions/_299.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 299. Bulls and Cows
5-
*
6-
* You are playing the following Bulls and Cows game with your friend:
7-
* You write down a number and ask your friend to guess what the number is.
8-
* Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in
9-
* both digit and position (called "bulls") and how many digits match the secret number but locate in the wrong position (called "cows").
10-
* Your friend will use successive guesses and hints to eventually derive the secret number.
11-
12-
For example:
13-
14-
Secret number: "1807"
15-
Friend's guess: "7810"
16-
Hint: 1 bull and 3 cows. (The bull is 8, the cows are 0, 1 and 7.)
17-
Write a function to return a hint according to the secret number and friend's guess, use A to indicate the bulls and B to indicate the cows. In the above example, your function should return "1A3B".
18-
19-
Please note that both secret number and friend's guess may contain duplicate digits, for example:
20-
21-
Secret number: "1123"
22-
Friend's guess: "0111"
23-
In this case, the 1st 1 in friend's guess is a bull, the 2nd or 3rd 1 is a cow, and your function should return "1A1B".
24-
You may assume that the secret number and your friend's guess only contain digits, and their lengths are always equal.*/
253
public class _299 {
264
public static class Solution1 {
275
public String getHint(String secret, String guess) {

0 commit comments

Comments
 (0)