当前位置:网站首页>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边栏推荐
- 怎么可以省去大量的switch语句,省去switch语句
- Summary of fun free GM games
- Graduation summary
- Calculation of favorable comment rate
- Aloam code reading and summary
- 自定义一个loading指令
- Memory mapping of QT
- Qt官方示例:Qt Quick Controls - Gallery
- 【愚公系列】2022年07月 Go教学课程 001-Go语言前提简介
- ESP32-C3入门教程 问题篇⑩——error: implicit declaration of function ‘esp_blufi_close‘;
猜你喜欢

ESP32-C3入门教程 问题篇⑩——error: implicit declaration of function ‘esp_blufi_close‘;

MySQL --- 数据库的基本概念

Editor编辑器扩展在Scene View添加按钮和logo

一个优秀程序员可抵五个普通程序员!

微信小程序视频分享平台系统毕业设计毕设(8)毕业设计论文模板

Nvidia 显卡 Failed to initialize NVML Driver/library version mismatch 错误解决方案

MySQL --- 数据库的基本操作
![[games101] operation 4 B é zier curve](/img/57/e7a9191b959cb1177b7bd1a439df2a.png)
[games101] operation 4 B é zier curve

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

RDK仿真实验
随机推荐
Wechat applet video sharing platform system graduation design completion (6) opening defense ppt
【Golang | gRPC】使用gRPC实现简单远程调用
vimium映射键
A good programmer is worth five ordinary programmers!
Wechat applet video sharing platform system graduation design completion (1) development outline
wait_ for_ Gap -- restore archive from primary archive to secondary Archive
微信核酸检测预约小程序系统毕业设计毕设(4)开题报告
Troubleshooting ideas that can solve 80% of faults
MySQL --- 数据库的基本概念
Intelligent hydropower meter energy consumption monitoring cloud platform
王者荣耀商城异地多活架构设计
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"
Detailed explanation of map set
微信小程序视频分享平台系统毕业设计毕设(1)开发概要
Easyai notes - deep learning
微信小程序视频分享平台系统毕业设计毕设(2)小程序功能
【愚公系列】2022年07月 Go教学课程 001-Go语言前提简介
拿起相机,便是最好的艺术疗愈
好评率计算
matplotlib的安装教程以及简单调用