当前位置:网站首页>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
边栏推荐
- Vimium mapping key
- vi/vim 删除:一行, 一个字符, 单词, 每行第一个字符 命令
- Mysql - opérations de base de la base de données
- Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found
- 如何开启IDEA的Run Dashboard功能
- Aptos教程-参与官方激励测试网(AIT2 激励测试网)
- Summary of fun free GM games
- 微信核酸检测预约小程序系统毕业设计毕设(3)后台功能
- ESP32-C3入门教程 问题篇⑪——esp-tls: create_ssl_handle failed, tls_io_instance->options.trusted_certs null
- 微信核酸检测预约小程序系统毕业设计毕设(5)任务书
猜你喜欢
微信核酸检测预约小程序系统毕业设计毕设(2)小程序功能
QT official example: QT quick controls - Gallery
Enter a valid user name and password in the Microsoft LDAP configuration page, and enter a valid user name in the Microsoft LDAP configuration page
Customize a loading instruction
Remember to use ternary expressions when switching transformations
【Golang | gRPC】使用gRPC实现简单远程调用
Summary of fun free GM games
详解Kubernetes网络模型
[games101] operation 4 B é zier curve
1288_ Implementation analysis of vtask resume() interface and interrupt Security version interface in FreeRTOS
随机推荐
Ora-19838 -- restore control files to the standby database
Qt官方示例:Qt Quick Controls - Gallery
架构设计——ID生成器「建议收藏」
王者荣耀商城异地多活架构设计
Wechat nucleic acid detection appointment applet system graduation design (2) applet function
求求你们,别再刷 Star 了!这跟“爱国”没关系!
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
719. 找出第 K 小的数对距离
Babbitt | metauniverse daily must read: can you buy a virtual anchor for 1000 yuan? Is this the live gospel of small businesses or "cutting leeks"
Wasserstein slim gain with clipping penalty (wsgain-cp) introduction and code implementation -- missing data filling based on generating countermeasure network
Clé de cartographie vimium
SteamOS 3.3 Beta 发布,Steam Deck 中文键盘终于来了
MySQL installation and configuration
QT official example: QT quick controls - Gallery
Aptos教程-参与官方激励测试网(AIT2 激励测试网)
ESP32-C3入门教程 问题篇⑪——esp-tls: create_ssl_handle failed, tls_io_instance->options.trusted_certs null
No such file or directory: ‘/tmp/tmpxxx/tmpxxx. py‘
【西北工业大学】考研初试复试资料分享
1288_FreeRTOS中vTaskResume()接口以及中断安全版本接口实现分析
实施阴影介绍