1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 11:21:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part2

This commit is contained in:
2022-03-27 20:38:29 +08:00
parent 5a4fa6db12
commit 0fc7f4b734
1617 changed files with 134637 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<p>珠玑妙算游戏the game of master mind的玩法如下。</p>
<p>计算机有4个槽每个槽放一个球颜色可能是红色R、黄色Y、绿色G或蓝色B。例如计算机可能有RGGB 4种槽1为红色槽2、3为绿色槽4为蓝色。作为用户你试图猜出颜色组合。打个比方你可能会猜YRGB。要是猜对某个槽的颜色则算一次“猜中”要是只猜对颜色但槽位猜错了则算一次“伪猜中”。注意“猜中”不能算入“伪猜中”。</p>
<p>给定一种颜色组合<code>solution</code>和一个猜测<code>guess</code>,编写一个方法,返回猜中和伪猜中的次数<code>answer</code>,其中<code>answer[0]</code>为猜中的次数,<code>answer[1]</code>为伪猜中的次数。</p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong> solution="RGBY",guess="GGRR"
<strong>输出:</strong> [1,1]
<strong>解释:</strong> 猜中1次伪猜中1次。
</pre>
<p><strong>提示:</strong></p>
<ul>
<li><code>len(solution) = len(guess) = 4</code></li>
<li><code>solution</code><code>guess</code>仅包含<code>"R"</code>,<code>"G"</code>,<code>"B"</code>,<code>"Y"</code>这4种字符</li>
</ul>