Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chinese Translation #869

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/algorithms/string/palindrome/README.md
Original file line number Diff line number Diff line change
@@ -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.
28 changes: 28 additions & 0 deletions src/algorithms/string/palindrome/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -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/)
3 changes: 3 additions & 0 deletions src/algorithms/string/regular-expression-matching/README.md
Original file line number Diff line number Diff line change
@@ -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 `*`.

70 changes: 70 additions & 0 deletions src/algorithms/string/regular-expression-matching/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -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/)