当前位置:网站首页>Leetcode 面试题 16.15. 珠玑妙算
Leetcode 面试题 16.15. 珠玑妙算
2022-07-02 16:44:00 【我不是萧海哇~~~~】

珠玑妙算游戏(the game of master mind)的玩法如下。
计算机有4个槽,每个槽放一个球,颜色可能是红色(R)、黄色(Y)、绿色(G)或蓝色(B)。例如,计算机可能有RGGB 4种(槽1为红色,槽2、3为绿色,槽4为蓝色)。作为用户,你试图猜出颜色组合。打个比方,你可能会猜YRGB。要是猜对某个槽的颜色,则算一次“猜中”;要是只猜对颜色但槽位猜错了,则算一次“伪猜中”。注意,“猜中”不能算入“伪猜中”。
给定一种颜色组合solution和一个猜测guess,编写一个方法,返回猜中和伪猜中的次数answer,其中answer[0]为猜中的次数,answer[1]为伪猜中的次数。
示例:
输入: solution="RGBY",guess="GGRR"
输出: [1边栏推荐
- Editor Editor Extension add button and logo in scene view
- Use Zadig to build a continuous delivery platform from 0 to 1
- Microsoft LDAP 配置页中输入有效的用户名及密码,microsoft ldap 配置页中输入有效的用户名
- Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found
- [golang | grpc] generate certificates using OpenSSL
- Wechat nucleic acid detection appointment applet system graduation design completion (4) opening report
- 面试,关于线程池的那些事
- Design of the multi live architecture in different places of the king glory mall
- QQmlApplicationEngine
- 【Golang | gRPC】使用openssl生成证书
猜你喜欢

Pit encountered during installation of laravel frame
![[golang | grpc] use grpc to realize simple remote call](/img/93/ae6eba2ba65d6e23bd00f45d04a2ed.png)
[golang | grpc] use grpc to realize simple remote call

MySQL进阶-事务及索引

In Linux, MySQL sets the job task to start automatically

自定义一个loading指令

切换变换的时候记得使用三元表达式

Picking up the camera is the best artistic healing

Develop a controller that prohibits deleting namespaces

微信小程序视频分享平台系统毕业设计毕设(4)开题报告

Intelligent hydropower meter energy consumption monitoring cloud platform
随机推荐
微信核酸检测预约小程序系统毕业设计毕设(3)后台功能
Wechat nucleic acid detection appointment applet system graduation design (2) applet function
Editor编辑器扩展在Scene View添加按钮和logo
求求你们,别再刷 Star 了!这跟“爱国”没关系!
微信小程序视频分享平台系统毕业设计毕设(8)毕业设计论文模板
Two pieces of nature a day! Duan Fengfeng, an alumnus of the University of science and technology of China, was the third Chinese winner of the belby medal
读写 XML/JSON/INI 和 UBJSON 等格式的数据文件的统一接口
Modbus protocol communication exception
Clé de cartographie vimium
Graduation summary
em120.gige. h
515. Find the maximum value in each tree row
国金证券是国企吗?在国金证券开户资金安全吗?
How can you omit a large number of switch statements
A4988与42步进电机
QT official example: QT quick controls - Gallery
微信核酸检测预约小程序系统毕业设计毕设(5)任务书
微信核酸检测预约小程序系统毕业设计毕设(1)开发概要
Android cycle timer implementation, to achieve fixed Android cache cleaning
Use dosbox to run the assembly super detailed step "suggestions collection"