Skip to content

Commit

Permalink
Perf docs
Browse files Browse the repository at this point in the history
  • Loading branch information
slhmy committed Jul 27, 2024
1 parent 09a3c09 commit 8ff8943
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

## 不能在 `while` 中使用 `(init; condition)` 的句式

在 C++ 17往后的版本中,你可以使用`if (init; condition)`
来在进行条件判断的同时初始化变量。
在 C++ 17往后的版本中,你可以使用 `if (init; condition)` 来在进行条件判断的同时初始化变量。

但你并不能在`while`中这么做,比较好理解的解释依旧是将其和`for`循环进行比较,
`for`循环中的`init`部分只会在循环开始时执行一次。
但你并不能在 `while` 中这么做,比较好理解的解释依旧是将其和 `for` 循环进行比较,
`for` 循环中的 `init` 部分只会在循环开始时执行一次。
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ sidebar_position: 1

# 参考文档

我个人更经常使用的是 [devdocs.io - cpp](https://devdocs.io/cpp/) 它实际上是个聚合站点,包含了很多语言的文档,包括 C++,当中的内容是由 [cppreference.com](https://en.cppreference.com/w/) 提供的。
我个人更经常使用的是
[devdocs.io - cpp](https://devdocs.io/cpp/)
它实际上是个聚合站点,包含了很多语言的文档,包括 C++,当中的内容是由
[cppreference.com](https://en.cppreference.com/w/)
提供的。
Original file line number Diff line number Diff line change
@@ -1,32 +1,10 @@
---
tags: ["力扣", "哈希表", "字符串"]
---
# 字母异位词分组

给你一个字符串数组,请你将 **字母异位词** 组合在一起。可以按任意顺序返回结果列表。

**字母异位词** 是由重新排列源单词的所有字母得到的一个新单词。

**示例 1:**

**输入:** strs = `["eat", "tea", "tan", "ate", "nat", "bat"]`<br/>
**输出:** \[\["bat"\],\["nat","tan"\],\["ate","eat","tea"\]\]

**示例 2:**

**输入:** strs = `[""]`<br/>
**输出:** \[\[""\]\]

**示例 3:**

**输入:** strs = `["a"]`<br/>
**输出:** \[\["a"\]\]

**提示:**
# 字母异位词分组

* `1 <= strs.length <= 104`
* `0 <= strs[i].length <= 100`
* `strs[i]` 仅包含小写字母
[原题链接](https://leetcode.cn/problems/group-anagrams/description/)

## 题解

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
# 移动零

给定一个数组 `nums`,编写一个函数将所有 `0` 移动到数组的末尾,同时保持非零元素的相对顺序。

**请注意** ,必须在不复制数组的情况下原地对数组进行操作。

**示例 1:**

**输入:** nums = `[0,1,0,3,12]`<br/>
**输出:** `[1,3,12,0,0]`
---
tags: ["力扣"]
---

**示例 2:**

**输入:** nums = `[0]`<br/>
**输出:** `[0]`

**提示**:

* `1 <= nums.length <= 104`
* `-231 <= nums[i] <= 231 - 1`
# 移动零

**进阶:** 你能尽量减少完成的操作次数吗?
[原题链接](https://leetcode.cn/problems/move-zeroes/description/)

## 题解

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ sidebar_position: 1
# 官方文档

:::tip
我的意思是,通常来说官方文档不会是你学习一门语言的第一步,但是它们是你学习一门语言的最后一步。它们是你在学习一门语言时的最佳参考资料。
我的意思是,通常来说官方文档不会是你学习一门语言的第一步,但是它们是你学习一门语言的最后一步。
它们是你在学习一门语言时的最佳参考资料。
:::

你可以访问 [Python3 文档](https://docs.python.org/3/) 查看详情,这个链接应该会自动定向到最新的 Python 版本。
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

## Unicode转换 `ord``chr`

- [ord](https://docs.python.org/3/library/functions.html?highlight=ord#ord):
- [ord](https://docs.python.org/3/library/functions.html?highlight=ord#ord)
字符转换为Integer Unicode码

- [chr](https://docs.python.org/3/library/functions.html?highlight=chr#chr):
- [chr](https://docs.python.org/3/library/functions.html?highlight=chr#chr)
Integer Unicode码转换为字符

## 排序 `sorted`

- [sorted](https://docs.python.org/3/library/functions.html?highlight=sorted#sorted):
- [sorted](https://docs.python.org/3/library/functions.html?highlight=sorted#sorted)
排序,返回一个新的列表

> ℹ️ 值得一提的是`sorted(str)`会返回一个列表,而不是字符串。
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 2
# 为什么是Python?

:::note
老实说,我在学生时代时,并没有很好地理解Python,但现在我发现它在某些场景下确实有着过人之处。
我在学生时代时,并没有很好地理解Python,但现在我发现它在某些场景下确实有着过人之处。
:::

编程语言有很多,在编写真实世界的系统时,我希望我的语言拥有高度完备的语法特性和安全检查
Expand All @@ -16,4 +16,5 @@ sidebar_position: 2

<u>而Python则不一样,你可以非常灵活地操控各种数据结构,并且它支持交互式编程,操作起来会更加简单。</u>

编写Python更接近于说话,老实说,把`!`替换成`not`;`&&`替换成`and`;`||`替换成`or`,对我并没有什么吸引力,但可能确实更适合新手入门。
编写Python更接近于说话,
老实说,把 `!` 替换成 `not`; `&&` 替换成 `and`; `||` 替换成 `or`,对我并没有什么吸引力,但可能确实更适合新手入门。

0 comments on commit 8ff8943

Please sign in to comment.