代码重构 【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>进入。
#### [1438. 绝对差不超过限制的最长连续子数组](https://leetcode-cn.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/)
@@ -13,7 +13,7 @@
示例
> 输入nums = [10,1,2,4,7,2], limit = 5
> 输出4
> 输出4
> 解释满足题意的最长子数组是 [2,4,7,2]其最大绝对差 |2-7| = 5 <= 5
**提示**
@@ -48,7 +48,7 @@ Java Code:
```java
class Solution {
public int longestSubarray(int[] nums, int limit) {
Deque<Integer> maxdeque = new LinkedList<>();
Deque<Integer> mindeque = new LinkedList<>();
int len = nums.length;
@@ -63,7 +63,7 @@ class Solution {
}
//需要更多视频解算法,可以来我的公众号:袁厨的算法小屋
maxdeque.addLast(nums[right]);
mindeque.addLast(nums[right]);
mindeque.addLast(nums[right]);
while (maxdeque.peekFirst() - mindeque.peekFirst() > limit) {
if (maxdeque.peekFirst() == nums[left]) maxdeque.removeFirst();
if (mindeque.peekFirst() == nums[left]) mindeque.removeFirst();
@@ -96,7 +96,7 @@ class Solution:
maxdeque.pop()
while len(mindeque) != 0 and mindeque[-1] > nums[right]:
mindeque.pop()
maxdeque.append(nums[right])
mindeque.append(nums[right])
while (maxdeque[0] - mindeque[0]) > limit:
@@ -114,6 +114,7 @@ class Solution:
Swift Code
Swift数组模拟超时58 / 61 个通过测试用例
```swift
class Solution {
func longestSubarray(_ nums: [Int], _ limit: Int) -> Int {
@@ -147,7 +148,7 @@ class Solution {
}
```
Swift使用双端队列击败了100.00%
Swift使用双端队列击败了 100.00%
```swift
class Solution {
@@ -259,4 +260,3 @@ class Solution {
}
}
```