Skip to content

Commit ec35b6d

Browse files
author
robot
committed
0.11.5
1 parent 302ff8c commit ec35b6d

File tree

3 files changed

+79
-8
lines changed

3 files changed

+79
-8
lines changed

‎config-overrides.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = function override(config, env) {
66
inject: "./src/inject.js",
77
};
88
config.optimization.runtimeChunk = false;
9+
config.optimization.splitChunks = void 0;
910

1011
// config.optimization.splitChunks = void 0;
1112
config.output.filename = "static/js/[name].js";

‎public/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "leetcode cheatsheet",
44
"description": "刷题小助手,made by 力扣加加",
5-
"version": "0.11.4",
5+
"version": "0.11.5",
66
"browser_action": {
77
"default_popup": "index.html",
88
"default_title": "力扣加加"

‎src/db/root.db.js

+77-7
Original file line numberDiff line numberDiff line change
@@ -2565,12 +2565,60 @@
25652565
"sort-colors":{
25662566
"id": "75",
25672567
"name": "sort-colors",
2568-
"pre": [],
2569-
"keyPoints": [],
2570-
"companies": [],
2568+
"pre": [
2569+
{
2570+
"text": "荷兰国旗问题",
2571+
"link": "https://en.wikipedia.org/wiki/Dutch_national_flag_problem",
2572+
"color": "purple"
2573+
},
2574+
{
2575+
"text": "排序",
2576+
"link": null,
2577+
"color": "purple"
2578+
}
2579+
],
2580+
"keyPoints": [
2581+
{
2582+
"text": "荷兰国旗问题",
2583+
"link": null,
2584+
"color": "blue"
2585+
},
2586+
{
2587+
"text": "countingsort",
2588+
"link": null,
2589+
"color": "blue"
2590+
}
2591+
],
2592+
"companies": [
2593+
{
2594+
"name": "阿里巴巴"
2595+
},
2596+
{
2597+
"name": "腾讯"
2598+
},
2599+
{
2600+
"name": "百度"
2601+
},
2602+
{
2603+
"name": "字节跳动"
2604+
}
2605+
],
25712606
"giteeSolution": "https://gitee.com/golong/leetcode/blob/master/problems/75.sort-colors.md",
25722607
"solution": "https://github.com/azl397985856/leetcode/blob/master/problems/75.sort-colors.md",
2573-
"code": []
2608+
"code": [
2609+
{
2610+
"language": "cpp",
2611+
"text": "\nclass Solution {\npublic:\n void sortColors(vector<int>& nums) {\n int r = 0, g = 0, b = 0;\n for (int n : nums) {\n if (n == 0) {\n nums[b++] = 2;\n nums[g++] = 1;\n nums[r++] = 0;\n } else if (n == 1) {\n nums[b++] = 2;\n nums[g++] = 1;\n } else nums[b++] = 2;\n }\n }\n};\n"
2612+
},
2613+
{
2614+
"language": "py",
2615+
"text": "\nclass Solution:\n def sortColors(self, strs):\n # p0 是右边界\n # p1 是右边界\n # p2 是���边界\n # p1 超过 p2 结束\n p0, p1, p2 = 0, 0, len(strs) - 1\n\n while p1 <= p2:\n if strs[p1] == 'blue':\n strs[p2], strs[p1] = strs[p1], strs[p2]\n p2 -= 1\n elif strs[p1] == 'red':\n strs[p0], strs[p1] = strs[p1], strs[p0]\n p0 += 1\n p1 += 1 # p0 一定不是 blue,因此 p1 += 1\n else: # p1 === 'green'\n p1 += 1\n return strs\n"
2616+
},
2617+
{
2618+
"language": "py",
2619+
"text": "\nclass Solution:\n def partition(self, head: ListNode, x: int) -> ListNode:\n l1 = cur = head\n while cur:\n if cur.val < x:\n cur.val, l1.val = l1.val, cur.val\n l1 = l1.next\n cur = cur.next\n return head\n"
2620+
}
2621+
]
25742622
},
25752623
"subsets":{
25762624
"id": "78",
@@ -10686,12 +10734,34 @@
1068610734
"snakes-and-ladders":{
1068710735
"id": "909",
1068810736
"name": "snakes-and-ladders",
10689-
"pre": [],
10690-
"keyPoints": [],
10737+
"pre": [
10738+
{
10739+
"text": "广度优先遍历",
10740+
"link": null,
10741+
"color": "gold"
10742+
}
10743+
],
10744+
"keyPoints": [
10745+
{
10746+
"text": "根据矩阵编号如何算出其都在的行号和列号。这里其实用到了number=(row",
10747+
"link": null,
10748+
"color": "blue"
10749+
},
10750+
{
10751+
"text": "1)\\*n+col这样的一个公式,后面的所有公式都是基于它产生的。",
10752+
"link": null,
10753+
"color": "blue"
10754+
}
10755+
],
1069110756
"companies": [],
1069210757
"giteeSolution": "https://gitee.com/golong/leetcode/blob/master/problems/909.snakes-and-ladders.md",
1069310758
"solution": "https://github.com/azl397985856/leetcode/blob/master/problems/909.snakes-and-ladders.md",
10694-
"code": []
10759+
"code": [
10760+
{
10761+
"language": "py",
10762+
"text": "\n\nclass Solution:\n def snakesAndLadders(self, board: List[List[int]]) -> int:\n q = collections.deque([(1, 0)])\n n = len(board)\n visited = set()\n\n def get_pos(pos):\n row = (n - 1) - (pos - 1) // n\n col = (n - 1) - ((pos - 1) % n) if row & 1 == n & 1 else (pos - 1) % n\n return row, col\n\n while q:\n for _ in range(len(q)):\n cur, steps = q.popleft()\n if cur in visited:\n continue\n visited.add(cur)\n if cur == n ** 2:\n return steps\n for nxt in range(cur + 1, min(cur + 6, n * n) + 1):\n row, col = get_pos(nxt)\n if board[row][col] == -1:\n q.append((nxt, steps + 1))\n else:\n q.append((board[row][col], steps + 1))\n return -1\n\n"
10763+
}
10764+
]
1069510765
},
1069610766
"online-election":{
1069710767
"id": "911",

0 commit comments

Comments
 (0)