代码重构 【Github Actions】

This commit is contained in:
github-actions[bot]
2021-07-23 15:44:19 +00:00
parent c79cac3d9c
commit f671c90754
94 changed files with 1609 additions and 2111 deletions

View File

@@ -1,8 +1,8 @@
> 如果阅读时发现错误或者动画不可以显示的问题可以添加我微信好友 **[tan45du_one](https://raw.githubusercontent.com/tan45du/tan45du.github.io/master/个人微信.15egrcgqd94w.jpg)** ,备注 github + 题目 + 问题 向我反馈
> 如果阅读时发现错误或者动画不可以显示的问题可以添加我微信好友 **[tan45du_one](https://raw.githubusercontent.com/tan45du/tan45du.github.io/master/个人微信.15egrcgqd94w.jpg)** ,备注 github + 题目 + 问题 向我反馈
>
> 感谢支持该仓库会一直维护希望对各位有一丢丢帮助
>
> 另外希望手机阅读的同学可以来我的 <u>[**公众号袁厨的算法小屋**](https://raw.githubusercontent.com/tan45du/test/master/微信图片_20210320152235.2pthdebvh1c0.png)</u> 两个平台同步,想要和题友一起刷题,互相监督的同学,可以在我的小屋点击<u>[**刷题小队**](https://raw.githubusercontent.com/tan45du/test/master/微信图片_20210320152235.2pthdebvh1c0.png)</u>进入。
> 另外希望手机阅读的同学可以来我的 <u>[**公众号袁厨的算法小屋**](https://raw.githubusercontent.com/tan45du/test/master/微信图片_20210320152235.2pthdebvh1c0.png)</u> 两个平台同步,想要和题友一起刷题,互相监督的同学,可以在我的小屋点击<u>[**刷题小队**](https://raw.githubusercontent.com/tan45du/test/master/微信图片_20210320152235.2pthdebvh1c0.png)</u>进入。
#### [86. 分隔链表](https://leetcode-cn.com/problems/partition-list/)
@@ -10,11 +10,10 @@
你应当 保留 两个分区中每个节点的初始相对位置
![](https://img-blog.csdnimg.cn/20210319190335143.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMzODg1OTI0,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20210319190335143.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMzODg1OTI0,size_16,color_FFFFFF,t_70)
示例 1
输入head = [1,4,3,2,5,2], x = 3
输出[1,2,2,4,3,5]
示例 2
@@ -24,7 +23,7 @@
来源力扣LeetCode
这个题目我的做题思路是这样的我们先创建一个侦察兵侦察兵负责比较链表值和 x 如果 >= 的话则接在 big 链表上小于则接到 small 链表上最后一个细节就是我们的 big 链表尾部要加上 null不然会形成环这是这个题目的一个小细节很重要
这个题目我的做题思路是这样的我们先创建一个侦察兵侦察兵负责比较链表值和 x 如果 >= 的话则接在 big 链表上小于则接到 small 链表上最后一个细节就是我们的 big 链表尾部要加上 null不然会形成环这是这个题目的一个小细节很重要
中心思想就是将链表先分后合
@@ -41,9 +40,9 @@ class Solution {
public ListNode partition(ListNode head, int x) {
ListNode pro = head;
ListNode big = new ListNode(-1);
ListNode small = new ListNode(-1);
ListNode headbig = big;
ListNode headsmall = small;
ListNode small = new ListNode(-1);
ListNode headbig = big;
ListNode headsmall = small;
//分
while (pro != null) {
//大于时,放到 big 链表上
@@ -74,9 +73,9 @@ public:
ListNode* partition(ListNode* head, int x) {
ListNode * pro = head;
ListNode * big = new ListNode(-1);
ListNode * small = new ListNode(-1);
ListNode * headbig = big;
ListNode * headsmall = small;
ListNode * small = new ListNode(-1);
ListNode * headbig = big;
ListNode * headsmall = small;
//分
while (pro != nullptr) {
//大于时,放到 big 链表上
@@ -102,30 +101,30 @@ public:
JS Code:
```js
var partition = function(head, x) {
let pro = head;
let big = new ListNode(-1);
let small = new ListNode(-1);
let headbig = big;
let headsmall = small;
//分
while (pro) {
//大于时,放到 big 链表上
if (pro.val >= x) {
big.next = pro;
big = big.next;
//小于时,放到 small 链表上
}else {
small.next = pro;
small = small.next;
}
pro = pro.next;
var partition = function (head, x) {
let pro = head;
let big = new ListNode(-1);
let small = new ListNode(-1);
let headbig = big;
let headsmall = small;
//分
while (pro) {
//大于时,放到 big 链表上
if (pro.val >= x) {
big.next = pro;
big = big.next;
//小于时,放到 small 链表上
} else {
small.next = pro;
small = small.next;
}
//细节
big.next = null;
//
small.next = headbig.next;
return headsmall.next;
pro = pro.next;
}
//细节
big.next = null;
//合
small.next = headbig.next;
return headsmall.next;
};
```