This commit is contained in:
Berlin 2024-07-17 10:41:46 +09:00 committed by GitHub
commit 2dcfc652c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 104 additions and 0 deletions

View File

@ -1,5 +1,8 @@
# Palindrome Check
_Read this in other languages:_
[中文](README.zh-CN.md)
A [Palindrome](https://en.wikipedia.org/wiki/Palindrome) is a string that reads the same forwards and backwards.
This means that the second half of the string is the reverse of the
first half.

View File

@ -0,0 +1,28 @@
# 回文检查
一个[回文串](https://en.wikipedia.org/wiki/Palindrome)是一个从前访问和从后访问相同的字符串。
这意味着字符串的后半部分与前半部分的翻转相同
## 例子
下面的是回文串 (所以将返回 `TRUE`):
```
- "a"
- "pop" -> p + o + p
- "deed" -> de + ed
- "kayak" -> ka + y + ak
- "racecar" -> rac + e + car
```
下面的不是回文串 (所以将返回 `FALSE`):
```
- "rad"
- "dodo"
- "polo"
```
## 参考
- [GeeksForGeeks - 检查一个数字是否回文](https://www.geeksforgeeks.org/check-if-a-number-is-palindrome/)

View File

@ -1,5 +1,8 @@
# Regular Expression Matching
_Read this in other languages:_
[中文](README.zh-CN.md)
Given an input string `s` and a pattern `p`, implement regular
expression matching with support for `.` and `*`.

View File

@ -0,0 +1,70 @@
# 正则表达式匹配
给定一个输入字符串 `s`,和一个模式 `p`,实现一个支持 `。``*` 的正则表达式匹配
- `。` 匹配任何单个字符。
- `*` 匹配零个或多个前面的那一个元素。
匹配应该覆盖**整个**输入字符串(不是一部分)
**注意**
- `s` 可以为空或者只包含小写 `a-z`
- `p` 可以为空或者只包含小写 `a-z`, 以及字符`。` or `*`
## 例子
**示例一**
输入:
```
s = 'aa'
p = 'a'
```
输出: `false`
解释:`a` 无法匹配 `aa` 整个字符串。
**示例二**
输入:
```
s = 'aa'
p = 'a*'
```
输出: `true`
解释:因为 `*` 代表可以匹配零个或多个前面的那一个元素, 在这里前面的元素就是 `a`。因此,字符串 `aa` 可被视为 `a` 重复了一次。
**示例三**
输入:
```
s = 'ab'
p = '。*'
```
输出: `true`
解释:`。*` 表示可匹配零个或多个(`*`)任意字符(`。`)。
**示例四**
输入:
```
s = 'aab'
p = 'c*a*b'
```
输出: `true`
解释: `c` 可以重复零次, `a` 可以重复一次。 因此可以匹配 `aab`
## 参考
- [油管](https//www。youtube。com/watch?v=l3hda49XcDE&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8&index=71&t=0s)
- [力扣](https//leetcode-cn。com/problems/regular-expression-matching/)