Add solution 0299

This commit is contained in:
halfrost
2021-11-08 21:21:21 +08:00
committed by halfrost
parent a47ce19ef2
commit 6fac7d3f8c
24 changed files with 1538 additions and 1398 deletions

View File

@ -1,4 +1,4 @@
# [299. Bulls and Cows](https://leetcode-cn.com/problems/bulls-and-cows/)
# [299. Bulls and Cows](https://leetcode.com/problems/bulls-and-cows/)
## 题目
@ -72,12 +72,14 @@ Output: "1A0B"
## 解题思路
- 计算下标一致并且对应下标的元素一致的个数即x
- secretguess分别去除x个公牛的元素,剩下secretguess求共同的元素个数就是y
- 把x y转换成字符串分别与"A""B"进行拼接返回结果
- 计算下标一致并且对应下标的元素一致的个数,即 x
- secretguess 分别去除 x 个公牛的元素,剩下 secretguess 求共同的元素个数就是 y
- x y 转换成字符串,分别与 "A""B" 进行拼接返回结果
## 代码
```go
package leetcode
import "strconv"