-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path29461.html
121 lines (110 loc) · 33.8 KB
/
29461.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE HTML><html lang="zh-CN"><head><meta charset="utf-8"><meta name="keywords" content="algorithm per day, huang"><meta name="description" content=""><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"><meta name="renderer" content="webkit|ie-stand|ie-comp"><meta name="mobile-web-app-capable" content="yes"><meta name="format-detection" content="telephone=no"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"><script async src="https://www.googletagmanager.com/gtag/js?id="></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","")</script><title>algorithm per day | huang</title><link rel="icon" type="image/png" href="/favicon.png"><link rel="stylesheet" href="/libs/awesome/css/all.css"><link rel="stylesheet" href="/libs/materialize/materialize.min.css"><link rel="stylesheet" href="/libs/aos/aos.css"><link rel="stylesheet" href="/libs/animate/animate.min.css"><link rel="stylesheet" href="/libs/lightGallery/css/lightgallery.min.css"><link rel="stylesheet" href="/css/matery.css"><link rel="stylesheet" href="/css/my.css"><script src="/libs/jquery/jquery.min.js"></script><meta name="generator" content="Hexo 4.2.0"><link rel="alternate" href="/atom.xml" title="huang" type="application/atom+xml"></head><body><header class="navbar-fixed"><nav id="headNav" class="bg-color nav-transparent"><div id="navContainer" class="nav-wrapper container"><div class="brand-logo"><a href="/" class="waves-effect waves-light"><img src="/medias/logo.png" class="logo-img" alt="LOGO"> <span class="logo-span">huang</span></a></div><a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a><ul class="right nav-menu"><li class="hide-on-med-and-down nav-item"><a href="/" class="waves-effect waves-light"><i class="fas fa-home" style="zoom:.6"></i> <span>首页</span></a></li><li class="hide-on-med-and-down nav-item"><a href="/tags" class="waves-effect waves-light"><i class="fas fa-tags" style="zoom:.6"></i> <span>标签</span></a></li><li class="hide-on-med-and-down nav-item"><a href="/categories" class="waves-effect waves-light"><i class="fas fa-bookmark" style="zoom:.6"></i> <span>分类</span></a></li><li class="hide-on-med-and-down nav-item"><a href="/archives" class="waves-effect waves-light"><i class="fas fa-archive" style="zoom:.6"></i> <span>归档</span></a></li><li class="hide-on-med-and-down nav-item"><a href="/about" class="waves-effect waves-light"><i class="fas fa-user-circle" style="zoom:.6"></i> <span>关于</span></a></li><li class="hide-on-med-and-down nav-item"><a href="/contact" class="waves-effect waves-light"><i class="fas fa-comments" style="zoom:.6"></i> <span>留言板</span></a></li><li class="hide-on-med-and-down nav-item"><a href="/friends" class="waves-effect waves-light"><i class="fas fa-address-book" style="zoom:.6"></i> <span>友情链接</span></a></li><li><a href="#searchModal" class="modal-trigger waves-effect waves-light"><i id="searchIcon" class="fas fa-search" title="搜索" style="zoom:.85"></i></a></li></ul><div id="mobile-nav" class="side-nav sidenav"><div class="mobile-head bg-color"><img src="/medias/logo.png" class="logo-img circle responsive-img"><div class="logo-name">huang</div><div class="logo-desc">Never really desperate, only the lost of the soul.</div></div><ul class="menu-list mobile-menu-list"><li class="m-nav-item"><a href="/" class="waves-effect waves-light"><i class="fa-fw fas fa-home"></i> 首页</a></li><li class="m-nav-item"><a href="/tags" class="waves-effect waves-light"><i class="fa-fw fas fa-tags"></i> 标签</a></li><li class="m-nav-item"><a href="/categories" class="waves-effect waves-light"><i class="fa-fw fas fa-bookmark"></i> 分类</a></li><li class="m-nav-item"><a href="/archives" class="waves-effect waves-light"><i class="fa-fw fas fa-archive"></i> 归档</a></li><li class="m-nav-item"><a href="/about" class="waves-effect waves-light"><i class="fa-fw fas fa-user-circle"></i> 关于</a></li><li class="m-nav-item"><a href="/contact" class="waves-effect waves-light"><i class="fa-fw fas fa-comments"></i> 留言板</a></li><li class="m-nav-item"><a href="/friends" class="waves-effect waves-light"><i class="fa-fw fas fa-address-book"></i> 友情链接</a></li><li><div class="divider"></div></li><li><a href="https://github.com/hyl2048" class="waves-effect waves-light" target="_blank"><i class="fab fa-github-square fa-fw"></i> Fork Me</a></li></ul></div></div><style>.nav-transparent .github-corner{display:none!important}.github-corner{position:absolute;z-index:10;top:0;right:0;border:0;transform:scale(1.1)}.github-corner svg{color:#0f9d58;fill:#fff;height:64px;width:64px}.github-corner:hover .octo-arm{animation:a .56s ease-in-out}.github-corner .octo-arm{animation:none}@keyframes a{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}</style><a href="https://github.com/hyl2048" class="github-corner tooltipped hide-on-med-and-down" target="_blank" data-tooltip="Fork Me" data-position="left" data-delay="50"><svg viewBox="0 0 250 250" aria-hidden="true"><path d="M0 0 115 115 130 115 142 142 250 250 250 0Z"></path><path d="M128.3 109C113.8 99.7 119 89.6 119 89.6 122 82.7 120.5 78.6 120.5 78.6 119.2 72 123.4 76.3 123.4 76.3 127.3 80.9 125.5 87.3 125.5 87.3 122.9 97.6 130.6 101.9 134.4 103.2" fill="currentColor" style="transform-origin:130px 106px" class="octo-arm"></path><path d="M115 115C114.9 115.1 118.7 116.5 119.8 115.4L133.7 101.6C136.9 99.2 139.9 98.4 142.2 98.6 133.8 88 127.5 74.4 143.8 58 148.5 53.4 154 51.2 159.7 51 160.3 49.4 163.2 43.6 171.4 40.1 171.4 40.1 176.1 42.5 178.8 56.2 183.1 58.6 187.2 61.8 190.9 65.4 194.5 69 197.7 73.2 200.1 77.6 213.8 80.2 216.3 84.9 216.3 84.9 212.7 93.1 206.9 96 205.4 96.6 205.1 102.4 203 107.8 198.3 112.5 181.9 128.9 168.3 122.5 157.7 114.1 157.9 116.9 156.7 120.9 152.7 124.9L141 136.5C139.8 137.7 141.6 141.9 141.8 141.8Z" fill="currentColor" class="octo-body"></path></svg></a></nav></header><div class="bg-cover pd-header post-cover" style="background-image:url(/medias/featureimages/0.jpg)"><div class="container" style="right:0;left:0"><div class="row"><div class="col s12 m12 l12"><div class="brand"><h1 class="description center-align post-title">algorithm per day</h1></div></div></div></div></div><main class="post-container content"><link rel="stylesheet" href="/libs/tocbot/tocbot.css"><style>#articleContent h1::before,#articleContent h2::before,#articleContent h3::before,#articleContent h4::before,#articleContent h5::before,#articleContent h6::before{display:block;content:" ";height:100px;margin-top:-100px;visibility:hidden}#articleContent :focus{outline:0}.toc-fixed{position:fixed;top:64px}.toc-widget{width:345px;padding-left:20px}.toc-widget .toc-title{margin:35px 0 15px 0;padding-left:17px;font-size:1.5rem;font-weight:700;line-height:1.5rem}.toc-widget ol{padding:0;list-style:none}#toc-content{height:calc(100vh - 250px);overflow:auto}#toc-content ol{padding-left:10px}#toc-content ol li{padding-left:10px}#toc-content .toc-link:hover{color:#42b983;font-weight:700;text-decoration:underline}#toc-content .toc-link::before{background-color:transparent;max-height:25px}#toc-content .is-active-link{color:#42b983}#toc-content .is-active-link::before{background-color:#42b983}#floating-toc-btn{position:fixed;right:15px;bottom:76px;padding-top:15px;margin-bottom:0;z-index:998}#floating-toc-btn .btn-floating{width:48px;height:48px}#floating-toc-btn .btn-floating i{line-height:48px;font-size:1.4rem}</style><div class="row"><div id="main-content" class="col s12 m12 l9"><div id="artDetail"><div class="card"><div class="card-content article-info"><div class="row tag-cate"><div class="col s7"><div class="article-tag"><span class="chip bg-color">无标签</span></div></div><div class="col s5 right-align"><div class="post-cate"><i class="fas fa-bookmark fa-fw icon-category"></i> <a href="/categories/Practice/" class="post-category">Practice</a></div></div></div><div class="post-info"><div class="post-date info-break-policy"><i class="far fa-calendar-minus fa-fw"></i> 发布日期: 2020-04-14</div></div></div><hr class="clearfix"><div class="card-content article-card-content"><div id="articleContent"><h3 id="在线编程题刷题平台"><a href="#在线编程题刷题平台" class="headerlink" title="在线编程题刷题平台"></a>在线编程题刷题平台</h3><p>Leetcode</p><p>赛码网</p><p>两个平台会作为不同企业的在线编程平台,他们的输入数据方式不太一样。赛码网中完全零开始,在使用Java语言时,使用Scanner来处理输入数据,见<a href="https://blog.csdn.net/justloveyou_/article/details/69263851" target="_blank" rel="noopener">Scanner类</a>的分析。</p><h2 id="day-1"><a href="#day-1" class="headerlink" title="day 1"></a>day 1</h2><h3 id="two-sum"><a href="#two-sum" class="headerlink" title="two-sum"></a>two-sum</h3><pre><code>暴力解法:时间复杂度为O(n^2)
运用HashMap:时间复杂度为O(1),相比较于暴力解法,在数据规模较大的时候,还是有时间上的优势的。
关于containsKey()方法,根据某种哈希算法,直接定位所要的元素,也就是说,这个查找的方法的时间复杂度最好为O(1),若没有直接找到,存储方式变为红黑树,查询复杂度为O(lgn),而并非O(n^2)。</code></pre><p>参考:<a href="https://blog.csdn.net/qingtian_1993/article/details/80763381" target="_blank" rel="noopener">containsKey()方法的复杂度为何为O(1)</a></p><h3 id="mini-parser"><a href="#mini-parser" class="headerlink" title="mini-parser"></a>mini-parser</h3><pre><code>相似题目 flatten-nested-list-iterator</code></pre><h2 id="day-2"><a href="#day-2" class="headerlink" title="day 2"></a>day 2</h2><h3 id="next-greater-element-ii"><a href="#next-greater-element-ii" class="headerlink" title="next-greater-element-ii"></a>next-greater-element-ii</h3><pre><code> 暴力解法;
运用栈;
在解决循环列表的时候,可以用循环链表、列表中每个数重复两次(可能会有取余操作)、可以用三个for循环(暴力解法)。
题目中使用栈作为相邻有先后顺寻的元素的存储介质,利用栈的特性,方便得到结果,时间复杂度为O(1),空间复杂度为O(1)。</code></pre><h3 id="biao-qian-yan-zheng-qi-by-leetcode"><a href="#biao-qian-yan-zheng-qi-by-leetcode" class="headerlink" title="biao-qian-yan-zheng-qi-by-leetcode"></a>biao-qian-yan-zheng-qi-by-leetcode</h3><pre><code> 这个题目先放放。</code></pre><h3 id="exclusive-time-of-functions"><a href="#exclusive-time-of-functions" class="headerlink" title="exclusive-time-of-functions"></a>exclusive-time-of-functions</h3><pre><code> 利用栈来做,类似于中缀表达式求值</code></pre><h3 id="baseball-game"><a href="#baseball-game" class="headerlink" title="baseball-game"></a>baseball-game</h3><pre><code> 利用栈的先进后出的特点来操作数据,类似于中缀表达式求值</code></pre><h2 id="day-3"><a href="#day-3" class="headerlink" title="day 3"></a>day 3</h2><h3 id="number-of-atoms"><a href="#number-of-atoms" class="headerlink" title="number-of-atoms"></a>number-of-atoms</h3><pre><code> 利用栈和map来解析化学表达式,其中得注意字符和数字处理的API,使用java.util.*来处理排序(Arrays)</code></pre><h2 id="day-4"><a href="#day-4" class="headerlink" title="day 4"></a>day 4</h2><h3 id="asteroid-collision"><a href="#asteroid-collision" class="headerlink" title="asteroid-collision"></a>asteroid-collision</h3><pre><code> 利用一个栈来的特点来操作数据,而不是用两个栈</code></pre><h3 id="dailyTemperatures"><a href="#dailyTemperatures" class="headerlink" title="dailyTemperatures"></a>dailyTemperatures</h3><pre><code> 利用栈的特点来操作数据,比暴力解法要快得多</code></pre><h2 id="day-5"><a href="#day-5" class="headerlink" title="day 5"></a>day 5</h2><h3 id="backspace-string-compare"><a href="#backspace-string-compare" class="headerlink" title="backspace-string-compare"></a>backspace-string-compare</h3><pre><code> 利用栈的特点来操作数据</code></pre><h3 id="score-of-parentheses"><a href="#score-of-parentheses" class="headerlink" title="score-of-parentheses"></a>score-of-parentheses</h3><pre><code> 第一种比较容易想到的方法是利用栈来操作数据,类似于中缀表达式求值。(O(N),O(N))
第二种方法:当仔细分析对结果有影响的因素时,会发现不同深度的()的得分会实质性地作用于最终的得分,其他的括号要么是累加,要么是将分数乘以2。进一步抽象,会发现2^x求和(x为()的深度)会是最终的结果(如果输入只有括号)。此时,并没有采用栈,而是发现了求最后结果的过程中,抽象出了数学表达式,利用数学表达式来求最后的结果。(O(N),O(1))
第三种方法:采用分治策略,组成最后的分的结果的要素分别相加求和。以平衡括号为字符串分解的点,若以左括号为1,右括号为-1,当遍历字符串时,S累加为0时,则说明有平衡括号()。(O(N^2),O(1))</code></pre><h3 id="decoded-string-at-index"><a href="#decoded-string-at-index" class="headerlink" title="decoded-string-at-index"></a>decoded-string-at-index</h3><pre><code>在影响最后结果的因素中,求出字符串结果不是必要的,反而,求出字符串变化后的size,能够实质性地助力求解最后地结果。
另一方面,在字符串变化的过程中,仔细观察,会发现,当节码字符串长度为size的词重复多次时,索引K的结果与K/size的结果一致。
正是这两个特点,就能够对暴力解法在时间复杂度或空间复杂度上作优化。
这也是一例没有采用栈结构来求解的方法,直接运用求值过程中良好的特点来优化求值过程。
(O(N),O(1))</code></pre><h3 id="maximum-frequency-stack"><a href="#maximum-frequency-stack" class="headerlink" title="maximum-frequency-stack"></a>maximum-frequency-stack</h3><pre><code>官方代码其中一行:
group.computeIfAbsent(f, z-> new Stack()).push(x);
(O(1),O(N))</code></pre><h3 id="online-stock-span"><a href="#online-stock-span" class="headerlink" title="online-stock-span"></a>online-stock-span</h3><pre><code>单调栈(栈中的数据非严格单调递减)
求出小于或等于今天价格的最大连续日数等价于求出最近的一个大于今日价格的日子
(O(N),O(N))</code></pre><h3 id="sum-of-subarray-minimums"><a href="#sum-of-subarray-minimums" class="headerlink" title="sum-of-subarray-minimums"></a>sum-of-subarray-minimums</h3><pre><code> 思路一:所有满足 `A[j]` 为最右且最小的元素的子序列个数 `#(j)`,那么结果就是 `sum #(j) * A[j]`.(O(N),O(N))
[c++ 单调栈](https://leetcode-cn.com/problems/sum-of-subarray-minimums/solution/cdan-diao-zhan-by-qwqcxh/)
思路二:想法是每当我们增加 `j`,这些最小值可能会有关联,事实上,`min(A[i:j+1]) = min(A[i:j], A[j+1])`。采用栈的数据结构。(O(N),O(N))
动态规划:
暴力解法:</code></pre><h3 id="odd-even-jump"><a href="#odd-even-jump" class="headerlink" title="odd-even-jump"></a>odd-even-jump</h3><h3 id="check-if-word-is-valid-after-substitutions"><a href="#check-if-word-is-valid-after-substitutions" class="headerlink" title="check-if-word-is-valid-after-substitutions"></a>check-if-word-is-valid-after-substitutions</h3><pre><code>class Solution {
public boolean isValid(String S) {
while(S.contains("abc")) {
S = S.replaceAll("abc","");
}
return S.equals("");
}
}</code></pre><h3 id="next-greater-node-in-linked-list"><a href="#next-greater-node-in-linked-list" class="headerlink" title="next-greater-node-in-linked-list"></a>next-greater-node-in-linked-list</h3><pre><code>采用单调栈
暴力解法
[单调栈解法的其他题目](https://leetcode-cn.com/problems/next-greater-node-in-linked-list/solution/python-dan-diao-zhan-by-jackwener/)</code></pre><h2 id="day-6"><a href="#day-6" class="headerlink" title="day 6"></a>day 6</h2><h3 id="longest-well-performing-interval"><a href="#longest-well-performing-interval" class="headerlink" title="longest-well-performing-interval"></a>longest-well-performing-interval</h3><pre><code>这个题目等下做</code></pre><p>2020.10.15</p><pre><code>merge_intervals
Array.sort(),比较器comparator
https://blog.csdn.net/waldmer/article/details/13015951</code></pre><p>2020.10.18</p><p>关于栈和递归</p><p> <a href="https://juejin.im/post/6844903981601259533" target="_blank" rel="noopener">递归的时间复杂度与空间复杂度</a></p><p>关于队列</p><p>关于排序的</p><p> 记忆各种排序方法</p><p> leetcode insertion-sort-list</p><p> 注意断链别形成环,造成死循环</p><p> sort-list</p><p> 链表的头部处理?</p><p> 链表操作,断链cut、挂接merge等</p><p>2020.10.19</p><p> <a href="https://leetcode-cn.com/problems/maximum-gap/solution/zui-da-jian-ju-by-leetcode/" target="_blank" rel="noopener"><strong><em>最大间距</em></strong></a>,<strong>线性空间复杂度</strong>以及<strong>线性时间复杂度</strong>解决这个问题。桶排序;基数排序可行。</p><p> <a href="https://leetcode-cn.com/problems/largest-number/solution/zui-da-shu-bi-jiao-gui-ze-chuan-di-xing-yi-ji-suan/" target="_blank" rel="noopener">最大数</a>(largest-number),算法的性质的证明;算法的正确性的证明</p><p> <a href="https://leetcode-cn.com/problems/contains-duplicate-iii/" target="_blank" rel="noopener">contains-duplicate-iii</a>:二叉搜索树(BST)、<a href="https://leetcode-cn.com/problems/contains-duplicate-iii/solution/cun-zai-zhong-fu-yuan-su-iii-by-leetcode/" target="_blank" rel="noopener">自平衡二叉树的运用(AVL)</a>、红黑树(RBT)、<a href="https://leetcode-cn.com/problems/contains-duplicate-iii/solution/cun-zai-zhong-fu-yuan-su-iii-by-leetcode/" target="_blank" rel="noopener">桶排序的运用</a>(散列表) —java实现自平衡二叉树的细节</p><p> <a href="https://leetcode-cn.com/problems/valid-anagram/" target="_blank" rel="noopener">有效的字母异位词(valid-anagram)</a>:</p><p></p><p></p></div><hr><div class="reprint" id="reprint-statement"><div class="reprint__author"><span class="reprint-meta" style="font-weight:700"><i class="fas fa-user">文章作者:</i></span> <span class="reprint-info"><a href="https://hyl2048.github.io" rel="external nofollow noreferrer">yulin</a></span></div><div class="reprint__type"><span class="reprint-meta" style="font-weight:700"><i class="fas fa-link">文章链接:</i></span> <span class="reprint-info"><a href="https://hyl2048.github.io/29461.html">https://hyl2048.github.io/29461.html</a></span></div><div class="reprint__notice"><span class="reprint-meta" style="font-weight:700"><i class="fas fa-copyright">版权声明:</i></span> <span class="reprint-info">本博客所有文章除特別声明外,均采用 <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a> 许可协议。转载请注明来源 <a href="https://hyl2048.github.io" target="_blank">yulin</a> !</span></div></div><script async defer>document.addEventListener("copy", function (e) {
let toastHTML = '<span>复制成功,请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
M.toast({html: toastHTML})
});
function navToReprintStatement() {
$("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
}</script><div class="tag_share" style="display:block"><div class="post-meta__tag-list" style="display:inline-block"><div class="article-tag"><span class="chip bg-color">无标签</span></div></div><div class="post_share" style="zoom:80%;width:fit-content;display:inline-block;float:right;margin:-.15rem 0"><link rel="stylesheet" href="/libs/share/css/share.min.css"><div id="article-share"><div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享!</p>"></div><script src="/libs/share/js/social-share.min.js"></script></div></div></div><style>#reward{margin:40px 0;text-align:center}#reward .reward-link{font-size:1.4rem;line-height:38px}#reward .btn-floating:hover{box-shadow:0 6px 12px rgba(0,0,0,.2),0 5px 15px rgba(0,0,0,.2)}#rewardModal{width:320px;height:350px}#rewardModal .reward-title{margin:15px auto;padding-bottom:5px}#rewardModal .modal-content{padding:10px}#rewardModal .close{position:absolute;right:15px;top:15px;color:rgba(0,0,0,.5);font-size:1.3rem;line-height:20px;cursor:pointer}#rewardModal .close:hover{color:#ef5350;transform:scale(1.3);-moz-transform:scale(1.3);-webkit-transform:scale(1.3);-o-transform:scale(1.3)}#rewardModal .reward-tabs{margin:0 auto;width:210px}.reward-tabs .tabs{height:38px;margin:10px auto;padding-left:0}.reward-content ul{padding-left:0!important}.reward-tabs .tabs .tab{height:38px;line-height:38px}.reward-tabs .tab a{color:#fff;background-color:#ccc}.reward-tabs .tab a:hover{background-color:#ccc;color:#fff}.reward-tabs .wechat-tab .active{color:#fff!important;background-color:#22ab38!important}.reward-tabs .alipay-tab .active{color:#fff!important;background-color:#019fe8!important}.reward-tabs .reward-img{width:210px;height:210px}</style><div id="reward"><a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a><div id="rewardModal" class="modal"><div class="modal-content"><a class="close modal-close"><i class="fas fa-times"></i></a><h4 class="reward-title">你的赏识是我前进的动力</h4><div class="reward-content"><div class="reward-tabs"><ul class="tabs row"><li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li><li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li></ul><div id="alipay"><img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码"></div><div id="wechat"><img src="/medias/reward/wechat.jpg" class="reward-img" alt="微信打赏二维码"></div></div></div></div></div></div><script>$(function(){$(".tabs").tabs()})</script></div></div><link rel="stylesheet" href="/libs/gitalk/gitalk.css"><link rel="stylesheet" href="/css/my-gitalk.css"><div class="card gitalk-card" data-aos="fade-up"><div class="comment_headling" style="font-size:20px;font-weight:700;position:relative;padding-left:20px;top:15px;padding-bottom:5px"><i class="fas fa-comments fa-fw" aria-hidden="true"></i> <span>评论</span></div><div id="gitalk-container" class="card-content"></div></div><script src="/libs/gitalk/gitalk.min.js"></script><script>let gitalk = new Gitalk({
clientID: '9e23a93e6d565c5b255e',
clientSecret: '3b42941e0d79049bad19fac40d7d0c1cae96edbe',
repo: 'hyl2048.github.io',
owner: 'hyl2048',
admin: "hyl2048",
id: '2020-04-14T10-08-35',
distractionFreeMode: false, // Facebook-like distraction free mode
proxy: "https://antiproxy.hyl2048.workers.dev/?https://github.com/login/oauth/access_token"
});
gitalk.render('gitalk-container');</script><article id="prenext-posts" class="prev-next articles"><div class="row article-row"><div class="article col s12 m6" data-aos="fade-up"><div class="article-badge left-badge text-color"><i class="fas fa-chevron-left"></i> 上一篇</div><div class="card"><a href="/30574.html"><div class="card-image"><img src="/medias/featureimages/23.jpg" class="responsive-img" alt="Bugs"> <span class="card-title">Bugs</span></div></a><div class="card-content article-content"><div class="summary block-with-text">Hexohexo发布文章报错can not read a block mapping entry bertBert在Win10启动server TypeError: cannot unpack non-iterable NoneType o</div><div class="publish-info"><span class="publish-date"><i class="far fa-clock fa-fw icon-date"></i> 2020-04-14</span><span class="publish-author"><i class="fas fa-bookmark fa-fw icon-category"></i> <a href="/categories/Bugs/" class="post-category">Bugs</a></span></div></div></div></div><div class="article col s12 m6" data-aos="fade-up"><div class="article-badge right-badge text-color">下一篇 <i class="fas fa-chevron-right"></i></div><div class="card"><a href="/65248.html"><div class="card-image"><img src="/medias/featureimages/13.jpg" class="responsive-img" alt="hexo+github/gitee/gitlab+optimization"> <span class="card-title">hexo+github/gitee/gitlab+optimization</span></div></a><div class="card-content article-content"><div class="summary block-with-text">参考文章建站Hexo+GitHub1.juejin.im/post/5dd2e898e51d45400206a4662.godweiyang.com/2018/04/13/hexo-blog/3.blog.sky03.cn/posts/41</div><div class="publish-info"><span class="publish-date"><i class="far fa-clock fa-fw icon-date"></i> 2020-04-14</span><span class="publish-author"><i class="fas fa-user fa-fw"></i> yulin</span></div></div></div></div></div></article></div><script>$("#articleContent").on("copy",function(e){if(void 0!==window.getSelection){var n=window.getSelection();if(!((""+n).length<Number.parseInt("120"))){var t=document.getElementsByTagName("body")[0],o=document.createElement("div");o.style.position="absolute",o.style.left="-99999px",t.appendChild(o),o.appendChild(n.getRangeAt(0).cloneContents()),"PRE"===n.getRangeAt(0).commonAncestorContainer.nodeName&&(o.innerHTML="<pre>"+o.innerHTML+"</pre>");var i=document.location.href;o.innerHTML+='<br />来源: huang<br />文章作者: yulin<br />文章链接: <a href="'+i+'">'+i+"</a><br />本文章著作权归作者所有,任何形式的转载都请注明出处。",n.selectAllChildren(o),window.setTimeout(function(){t.removeChild(o)},200)}}})</script><script src="/libs/codeBlock/codeBlockFuction.js"></script><script src="/libs/codeBlock/codeLang.js"></script><script src="/libs/codeBlock/codeCopy.js"></script><script src="/libs/codeBlock/codeShrink.js"></script><style>code[class*=language-],pre[class*=language-]{white-space:pre!important}</style></div><div id="toc-aside" class="expanded col l3 hide-on-med-and-down"><div class="toc-widget"><div class="toc-title"><i class="far fa-list-alt"></i> 目录</div><div id="toc-content"></div></div></div></div><div id="floating-toc-btn" class="hide-on-med-and-down"><a class="btn-floating btn-large bg-color"><i class="fas fa-list-ul"></i></a></div><script src="/libs/tocbot/tocbot.min.js"></script><script>$(function () {
tocbot.init({
tocSelector: '#toc-content',
contentSelector: '#articleContent',
headingsOffset: -($(window).height() * 0.4 - 45),
collapseDepth: Number('0'),
headingSelector: 'h2, h3, h4'
});
// modify the toc link href to support Chinese.
let i = 0;
let tocHeading = 'toc-heading-';
$('#toc-content a').each(function () {
$(this).attr('href', '#' + tocHeading + (++i));
});
// modify the heading title id to support Chinese.
i = 0;
$('#articleContent').children('h2, h3, h4').each(function () {
$(this).attr('id', tocHeading + (++i));
});
// Set scroll toc fixed.
let tocHeight = parseInt($(window).height() * 0.4 - 64);
let $tocWidget = $('.toc-widget');
$(window).scroll(function () {
let scroll = $(window).scrollTop();
/* add post toc fixed. */
if (scroll > tocHeight) {
$tocWidget.addClass('toc-fixed');
} else {
$tocWidget.removeClass('toc-fixed');
}
});
/* 修复文章卡片 div 的宽度. */
let fixPostCardWidth = function (srcId, targetId) {
let srcDiv = $('#' + srcId);
if (srcDiv.length === 0) {
return;
}
let w = srcDiv.width();
if (w >= 450) {
w = w + 21;
} else if (w >= 350 && w < 450) {
w = w + 18;
} else if (w >= 300 && w < 350) {
w = w + 16;
} else {
w = w + 14;
}
$('#' + targetId).width(w);
};
// 切换TOC目录展开收缩的相关操作.
const expandedClass = 'expanded';
let $tocAside = $('#toc-aside');
let $mainContent = $('#main-content');
$('#floating-toc-btn .btn-floating').click(function () {
if ($tocAside.hasClass(expandedClass)) {
$tocAside.removeClass(expandedClass).hide();
$mainContent.removeClass('l9');
} else {
$tocAside.addClass(expandedClass).show();
$mainContent.addClass('l9');
}
fixPostCardWidth('artDetail', 'prenext-posts');
});
});</script></main><script src="https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script>MathJax.Hub.Config({tex2jax:{inlineMath:[["$","$"],["(",")"]]}})</script><footer class="page-footer bg-color"><link rel="stylesheet" href="/libs/aplayer/APlayer.min.css"><style>.aplayer .aplayer-lrc p{font-size:12px;font-weight:700;line-height:16px!important}.aplayer .aplayer-lrc p.aplayer-lrc-current{font-size:15px;color:#42b983}.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body{left:-66px!important}.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover{left:0!important}</style><div><div><meting-js class="col l8 offset-l2 m10 offset-m1 s12" server="netease" type="playlist" id="503838841" fixed="true" autoplay theme="#42b983" loop order="random" preload="auto" volume="0.7" list-folded="true"></meting-js></div></div><script src="/libs/aplayer/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script><div class="container row center-align"><div class="col s12 m8 l8 copy-right">©huang. 版权所有 <i class="fa fa-area-chart"></i> 站点总字数: <span class="white-color">105.1k</span><br><span id="sitetime"></span><br><span id="busuanzi_container_site_pv" style="display:none"><i class="fa fa-heart-o"></i> 本站总访问量<span id="busuanzi_value_site_pv" class="white-color"></span></span> <span id="busuanzi_container_site_uv" style="display:none">人次, 访客数<span id="busuanzi_value_site_uv" class="white-color"></span> 人.</span></div><div class="col s12 m4 l4 social-link social-statis"><a href="https://github.com/hyl2048" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50"><i class="fab fa-github"></i></a><a href="mailto:[email protected]" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50"><i class="fas fa-envelope-open"></i></a><a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=2745506937" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 2745506937" data-position="top" data-delay="50"><i class="fab fa-qq"></i></a><a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50"><i class="fas fa-rss"></i></a></div></div></footer><div class="progress-bar"></div><script>$(document).ready(function(){var e=setInterval(function(){"none"!=document.getElementById("busuanzi_container_site_pv").style.display&&($("#busuanzi_value_site_pv").html(parseInt($("#busuanzi_value_site_pv").html())+n),clearInterval(e));"none"!=$("#busuanzi_container_site_pv").css("display")&&($("#busuanzi_value_site_uv").html(parseInt($("#busuanzi_value_site_uv").html())+t),clearInterval(e))},50),n=0,t=0})</script><script language="javascript">function siteTime(){window.setTimeout("siteTime()",1e3);var e=36e5,t=24*e,o=new Date,i=o.getFullYear(),a=o.getMonth()+1,n=o.getDate(),r=o.getHours(),l=o.getMinutes(),s=o.getSeconds(),M=Date.UTC(2020,3,28,0,0,0),g=Date.UTC(i,a,n,r,l,s)-M,m=Math.floor(g/31536e6),T=Math.floor(g/t-365*m),f=Math.floor((g-(365*m+T)*t)/e),h=Math.floor((g-(365*m+T)*t-f*e)/6e4),u=Math.floor((g-(365*m+T)*t-f*e-6e4*h)/1e3);document.getElementById("sitetime").innerHTML="本站已运行 "+m+" 年 "+T+" 天 "+f+" 小时 "+h+" 分钟 "+u+" 秒"}siteTime()</script><div id="searchModal" class="modal"><div class="modal-content"><div class="search-header"><span class="title"><i class="fas fa-search"></i> 搜索</span> <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字" class="search-input"></div><div id="searchResult"></div></div></div><script src="/js/search.js"></script><script>$(function(){searchFunc("/search.xml","searchInput","searchResult")})</script><div id="backTop" class="top-scroll"><a class="btn-floating btn-large waves-effect waves-light" href="#!"><i class="fas fa-arrow-up"></i></a></div><script src="/libs/materialize/materialize.min.js"></script><script src="/libs/masonry/masonry.pkgd.min.js"></script><script src="/libs/aos/aos.js"></script><script src="/libs/scrollprogress/scrollProgress.min.js"></script><script src="/libs/lightGallery/js/lightgallery-all.min.js"></script><script src="/js/matery.js"></script><script>var _hmt=_hmt||[];!function(){var e=document.createElement("script");e.src="https://hm.baidu.com/hm.js?";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}()</script><script>!function(){var t=document.createElement("script"),e=window.location.protocol.split(":")[0];t.src="https"===e?"https://zz.bdstatic.com/linksubmit/push.js":"http://push.zhanzhang.baidu.com/push.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}()</script><script src="/libs/others/clicklove.js" async></script><script async src="/libs/others/busuanzi.pure.mini.js"></script><script src="/libs/instantpage/instantpage.js" type="module"></script></body></html>