Skip to content

Commit 7b69b6d

Browse files
committedSep 8, 2021
feat: add lcs/lcp problems
1 parent 9a6e4a9 commit 7b69b6d

File tree

78 files changed

+3146
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3146
-1
lines changed
 

‎index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
name: 'leetcode',
2929
logo: '/images/doocs-leetcode.png',
3030
search: [
31-
'/', '/solution/', '/lcof/', '/lcof2/', '/lcci/', '/basic/'
31+
'/', '/solution/', '/lcof/', '/lcof2/', '/lcci/', '/lcs', 'lcp', '/basic/'
3232
],
3333
loadSidebar: 'summary.md',
3434
auto2top: true,
3535
subMaxLevel: 2,
3636
alias: {
37+
'/lcs/.*/summary.md': '/lcs/summary.md',
38+
'/lcp/.*/summary.md': '/lcp/summary.md',
3739
'/lcci/.*/summary.md': '/lcci/summary.md',
3840
'/lcof/.*/summary.md': '/lcof/summary.md',
3941
'/lcof2/.*/summary.md': '/lcof2/summary.md',

‎lcp/LCP 01. 猜数字/README.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# [LCP 01. 猜数字](https://leetcode-cn.com/problems/guess-numbers)
2+
3+
## 题目描述
4+
5+
<!-- 这里写题目描述 -->
6+
7+
<p>小A 和 小B 在玩猜数字。小B 每次从 1, 2, 3 中随机选择一个,小A 每次也从 1, 2, 3 中选择一个猜。他们一共进行三次这个游戏,请返回 小A 猜对了几次?</p>
8+
9+
<p>输入的<code>guess</code>数组为 小A 每次的猜测,<code>answer</code>数组为 小B 每次的选择。<code>guess</code>和<code>answer</code>的长度都等于3。</p>
10+
11+
<p> </p>
12+
13+
<p><strong>示例 1:</strong></p>
14+
15+
<pre>
16+
<strong>输入:</strong>guess = [1,2,3], answer = [1,2,3]
17+
<strong>输出:</strong>3
18+
<strong>解释:</strong>小A 每次都猜对了。</pre>
19+
20+
<p><strong>示例 2:</strong></p>
21+
22+
<pre>
23+
<strong>输入:</strong>guess = [2,2,3], answer = [3,2,1]
24+
<strong>输出:</strong>1
25+
<strong>解释:</strong>小A 只猜对了第二次。</pre>
26+
27+
<p> </p>
28+
29+
<p><strong>限制:</strong></p>
30+
31+
<ol>
32+
<li><code>guess</code> 的长度 = 3</li>
33+
<li><code>answer</code> 的长度 = 3</li>
34+
<li><code>guess</code> 的元素取值为 <code>{1, 2, 3}</code> 之一。</li>
35+
<li><code>answer</code> 的元素取值为 <code>{1, 2, 3}</code> 之一。</li>
36+
</ol>
37+
38+
39+
## 解法
40+
41+
<!-- 这里可写通用的实现逻辑 -->
42+
43+
<!-- tabs:start -->
44+
45+
### **Python3**
46+
47+
<!-- 这里可写当前语言的特殊实现逻辑 -->
48+
49+
```python
50+
51+
```
52+
53+
### **Java**
54+
55+
<!-- 这里可写当前语言的特殊实现逻辑 -->
56+
57+
```java
58+
59+
```
60+
61+
### **...**
62+
63+
```
64+
65+
```
66+
67+
<!-- tabs:end -->

0 commit comments

Comments
 (0)