当前位置:网站首页>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边栏推荐
- 2020互联网行业术语
- 2020 Internet industry terminology
- 王者荣耀商城异地多活架构设计
- 详解Kubernetes网络模型
- Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode
- Redisson 高性能 Redis 分布式锁源码分析
- 初夏,开源魔改一个带击杀音效的电蚊拍!
- 巴比特 | 元宇宙每日必读:一千块就能买一个虚拟主播?这是小企业的直播福音还是在“割韭菜”?...
- 拿起相机,便是最好的艺术疗愈
- Wechat applet video sharing platform system graduation design (2) applet function
猜你喜欢

Wechat applet video sharing platform system graduation design (2) applet function

微信小程序视频分享平台系统毕业设计毕设(7)中期检查报告

Laravel框架安装时遇到的坑

How to download wechat payment certificate (API certificate)

pycharm 修改 pep8 E501 line too long > 0 characters

Wechat applet video sharing platform system graduation design completion (4) opening report

微信小程序视频分享平台系统毕业设计毕设(6)开题答辩PPT

如何开启IDEA的Run Dashboard功能

Microsoft LDAP 配置页中输入有效的用户名及密码,microsoft ldap 配置页中输入有效的用户名

1288_ Implementation analysis of vtask resume() interface and interrupt Security version interface in FreeRTOS
随机推荐
Easyai notes - deep learning
719. Find the distance of the number pair with the smallest K
Vimium mapping key
微信小程序视频分享平台系统毕业设计毕设(8)毕业设计论文模板
WPS inserts a picture and displays it completely
Interview, about thread pool
wait_ for_ Gap -- restore archive from primary archive to secondary Archive
MySQL advanced - transaction and index
Wechat applet video sharing platform system graduation design completion (6) opening defense ppt
微信小程序视频分享平台系统毕业设计毕设(5)任务书
719. 找出第 K 小的数对距离
Editor编辑器扩展在Scene View添加按钮和logo
微信小程序视频分享平台系统毕业设计毕设(4)开题报告
SteamOS 3.3 Beta 发布,Steam Deck 中文键盘终于来了
Modbus protocol communication exception
Mysql 备份的三种方式
微信核酸检测预约小程序系统毕业设计毕设(1)开发概要
MySQL --- 数据库的基本操作
使用Zadig从0到1搭建持续交付平台
微信核酸检测预约小程序系统毕业设计毕设(5)任务书