Skip to content

Commit 5bc0568

Browse files
committed
fix some bugs.
1 parent d04306f commit 5bc0568

File tree

28 files changed

+754
-782
lines changed

28 files changed

+754
-782
lines changed

.DS_Store

2 KB
Binary file not shown.

categories/2021/index.xml

+68-75
Large diffs are not rendered by default.

categories/technology/index.xml

+68-75
Large diffs are not rendered by default.

docs/_print/index.html

+68-75
Large diffs are not rendered by default.

docs/algorithm/_print/index.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,13 @@ <h1 id="pg-aebee7a2ccf06e8dc7bd34e98d4657c6">1 - leetcode算法总结(UPDATE-1)<
206206
</blockquote>
207207
<p>本文内容依据我在使用c++完成各类leetcode问题时得到的有效信息和经验写成。</p>
208208
<p>P.S.可能更强调在c++的使用上而非各类逆天的算法解决方案上。</p>
209-
<h3 id="1-一些c标准库函数">1. 一些C++标准库函数</h3>
210-
<h4 id="reverse">reverse</h4>
209+
<h2 id="1-一些c标准库函数">1. 一些C++标准库函数</h2>
210+
<h3 id="reverse">reverse</h3>
211211
<p>这个好像可以用来反转很多C++支持的数据结构,一般是两个输入参量,用法大概是这样。reverse(开始位置,开始位置+需要翻转的数量),从这个角度看,它的输入参量是<strong>左闭右开</strong>的区间,例如reverse(string.begin(),string.end())&hellip;</p>
212212
<p>反正第一次用起来有点晕,极有可能c++很多的标准函数采用类似的输入形式,需要注意。</p>
213-
<h4 id="resize">resize</h4>
213+
<h3 id="resize">resize</h3>
214214
<p>反正对于字符串而言挺好使,直接resize(更新后的尺寸),可以直接把字符串扩充到指定长度,多出来的部分应该是空的吧。</p>
215-
<h4 id="sort">sort</h4>
215+
<h3 id="sort">sort</h3>
216216
<p>sort(begin(),end())这样用,反正可以直接按从小到大光速排序,这里的开始和结束参照reverse,输入是完全一样的方法。说明前面的猜想是正确的😄。</p>
217217
<p>好像还可以用自定义函数作为第三个输入参量来作为排序依据,这个等以后做题遇到的时候再写吧,没用过的东西一概不写😋。</p>
218218
<p><strong>以后随时更新&hellip;</strong></p>
@@ -238,25 +238,25 @@ <h1 id="pg-a9ae5938d84208521ccc8e62518aa358">2 - leetcode算法总结</h1>
238238
</blockquote>
239239
<p>本文内容依据我在使用c++完成各类leetcode问题时得到的有效信息和经验写成。</p>
240240
<p>P.S.可能更强调在c++的使用上而非各类逆天的算法解决方案上。</p>
241-
<h3 id="1-map">1. map</h3>
241+
<h2 id="1-map">1. map</h2>
242242
<p>总的来说map是一个非常好用的东西,很多可以用set的问题我依然使用map来解决,感觉很舒服。</p>
243-
<h4 id="创建">创建</h4>
243+
<h3 id="创建">创建</h3>
244244
<p>创建的时候需要指定好类型 map or unordered_map &lt; type , type &gt; variable_name,创建出来是空的。拿unordered_map&lt;string,int&gt; maps来举例。</p>
245-
<h4 id="插入删除">插入删除</h4>
245+
<h3 id="插入删除">插入删除</h3>
246246
<p>对于计数型应用(反正做题比较多),即后一个type是int的情况,用起来很简单,直接maps[&ldquo;hello&rdquo;]++,这样就在创建了对应key值并+1。这里使用上<strong>值得注意</strong>,当key对应的value值减到0时,并不意味着这个key就消失了,需要maps.erase(&ldquo;hello&rdquo;)才能真正抹掉对应的key值。</p>
247247
<p>其它的应用就需要使用maps.insert(pair&lt;string,string&gt;(&ldquo;hello&rdquo;,&ldquo;world&rdquo;))来插入了。</p>
248-
<h4 id="查找">查找</h4>
248+
<h3 id="查找">查找</h3>
249249
<p>作为一个哈希表,查找是其得到使用的根本原因。</p>
250250
<p>看一个key是不是在表里, if(maps.find(&ldquo;hello&rdquo;)!=maps.end()) ,如果返回true,则说明在表里。这里的返回值是一个迭代器,迭代器这么用,maps.find(&ldquo;hello&rdquo;)-&gt;first ,这就是key的值(也就是&quot;hello&quot;),maps.find(&ldquo;hello&rdquo;)-&gt;second ,这就是&quot;hello&quot;对应的value值。</p>
251251
<p>想遍历map,也得靠迭代器,先造个迭代器,unordered_map&lt;string,int&gt;::iterator itr,然后for循环的用法就跟一般的遍历差不多了。for(itr=maps.begin();itr!=maps.end();itr++)这样就能遍历啦。</p>
252-
<h3 id="2-string">2. string</h3>
252+
<h2 id="2-string">2. string</h2>
253253
<p>string的各种操作用法千奇百怪,很多感觉几乎等效。</p>
254-
<h4 id="assign">assign</h4>
254+
<h3 id="assign">assign</h3>
255255
<p>大概用法是 s1.assign(s,index,num) ,这样可以把s字符串从index索引值开始往后的num个字符赋给s1字符串。</p>
256256
<p>基本跟substr是一样的。</p>
257-
<h4 id="substr">substr</h4>
257+
<h3 id="substr">substr</h3>
258258
<p>s1=s.substr(index,num) ,这个操作跟使用assign是等效的。</p>
259-
<h3 id="3-for">3. for</h3>
259+
<h2 id="3-for">3. for</h2>
260260
<p>for循环一些自动遍历的trick之前没用过。</p>
261261
<p>比如for(auto i:nums)或者for(auto &amp;i:maps),后者取值用t.first和t.second即可。也可以for(auto &amp;[key,vaule]:maps)就能直接取到key和value啦。</p>
262262
<p><strong>以后随时更新&hellip;</strong></p>

docs/algorithm/index.xml

+12-12
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
&lt;/blockquote&gt;
2929
&lt;p&gt;本文内容依据我在使用c++完成各类leetcode问题时得到的有效信息和经验写成。&lt;/p&gt;
3030
&lt;p&gt;P.S.可能更强调在c++的使用上而非各类逆天的算法解决方案上。&lt;/p&gt;
31-
&lt;h3 id=&#34;1-一些c标准库函数&#34;&gt;1. 一些C++标准库函数&lt;/h3&gt;
32-
&lt;h4 id=&#34;reverse&#34;&gt;reverse&lt;/h4&gt;
31+
&lt;h2 id=&#34;1-一些c标准库函数&#34;&gt;1. 一些C++标准库函数&lt;/h2&gt;
32+
&lt;h3 id=&#34;reverse&#34;&gt;reverse&lt;/h3&gt;
3333
&lt;p&gt;这个好像可以用来反转很多C++支持的数据结构,一般是两个输入参量,用法大概是这样。reverse(开始位置,开始位置+需要翻转的数量),从这个角度看,它的输入参量是&lt;strong&gt;左闭右开&lt;/strong&gt;的区间,例如reverse(string.begin(),string.end())&amp;hellip;&lt;/p&gt;
3434
&lt;p&gt;反正第一次用起来有点晕,极有可能c++很多的标准函数采用类似的输入形式,需要注意。&lt;/p&gt;
35-
&lt;h4 id=&#34;resize&#34;&gt;resize&lt;/h4&gt;
35+
&lt;h3 id=&#34;resize&#34;&gt;resize&lt;/h3&gt;
3636
&lt;p&gt;反正对于字符串而言挺好使,直接resize(更新后的尺寸),可以直接把字符串扩充到指定长度,多出来的部分应该是空的吧。&lt;/p&gt;
37-
&lt;h4 id=&#34;sort&#34;&gt;sort&lt;/h4&gt;
37+
&lt;h3 id=&#34;sort&#34;&gt;sort&lt;/h3&gt;
3838
&lt;p&gt;sort(begin(),end())这样用,反正可以直接按从小到大光速排序,这里的开始和结束参照reverse,输入是完全一样的方法。说明前面的猜想是正确的😄。&lt;/p&gt;
3939
&lt;p&gt;好像还可以用自定义函数作为第三个输入参量来作为排序依据,这个等以后做题遇到的时候再写吧,没用过的东西一概不写😋。&lt;/p&gt;
4040
&lt;p&gt;&lt;strong&gt;以后随时更新&amp;hellip;&lt;/strong&gt;&lt;/p&gt;
@@ -56,25 +56,25 @@
5656
&lt;/blockquote&gt;
5757
&lt;p&gt;本文内容依据我在使用c++完成各类leetcode问题时得到的有效信息和经验写成。&lt;/p&gt;
5858
&lt;p&gt;P.S.可能更强调在c++的使用上而非各类逆天的算法解决方案上。&lt;/p&gt;
59-
&lt;h3 id=&#34;1-map&#34;&gt;1. map&lt;/h3&gt;
59+
&lt;h2 id=&#34;1-map&#34;&gt;1. map&lt;/h2&gt;
6060
&lt;p&gt;总的来说map是一个非常好用的东西,很多可以用set的问题我依然使用map来解决,感觉很舒服。&lt;/p&gt;
61-
&lt;h4 id=&#34;创建&#34;&gt;创建&lt;/h4&gt;
61+
&lt;h3 id=&#34;创建&#34;&gt;创建&lt;/h3&gt;
6262
&lt;p&gt;创建的时候需要指定好类型 map or unordered_map &amp;lt; type , type &amp;gt; variable_name,创建出来是空的。拿unordered_map&amp;lt;string,int&amp;gt; maps来举例。&lt;/p&gt;
63-
&lt;h4 id=&#34;插入删除&#34;&gt;插入删除&lt;/h4&gt;
63+
&lt;h3 id=&#34;插入删除&#34;&gt;插入删除&lt;/h3&gt;
6464
&lt;p&gt;对于计数型应用(反正做题比较多),即后一个type是int的情况,用起来很简单,直接maps[&amp;ldquo;hello&amp;rdquo;]++,这样就在创建了对应key值并+1。这里使用上&lt;strong&gt;值得注意&lt;/strong&gt;,当key对应的value值减到0时,并不意味着这个key就消失了,需要maps.erase(&amp;ldquo;hello&amp;rdquo;)才能真正抹掉对应的key值。&lt;/p&gt;
6565
&lt;p&gt;其它的应用就需要使用maps.insert(pair&amp;lt;string,string&amp;gt;(&amp;ldquo;hello&amp;rdquo;,&amp;ldquo;world&amp;rdquo;))来插入了。&lt;/p&gt;
66-
&lt;h4 id=&#34;查找&#34;&gt;查找&lt;/h4&gt;
66+
&lt;h3 id=&#34;查找&#34;&gt;查找&lt;/h3&gt;
6767
&lt;p&gt;作为一个哈希表,查找是其得到使用的根本原因。&lt;/p&gt;
6868
&lt;p&gt;看一个key是不是在表里, if(maps.find(&amp;ldquo;hello&amp;rdquo;)!=maps.end()) ,如果返回true,则说明在表里。这里的返回值是一个迭代器,迭代器这么用,maps.find(&amp;ldquo;hello&amp;rdquo;)-&amp;gt;first ,这就是key的值(也就是&amp;quot;hello&amp;quot;),maps.find(&amp;ldquo;hello&amp;rdquo;)-&amp;gt;second ,这就是&amp;quot;hello&amp;quot;对应的value值。&lt;/p&gt;
6969
&lt;p&gt;想遍历map,也得靠迭代器,先造个迭代器,unordered_map&amp;lt;string,int&amp;gt;::iterator itr,然后for循环的用法就跟一般的遍历差不多了。for(itr=maps.begin();itr!=maps.end();itr++)这样就能遍历啦。&lt;/p&gt;
70-
&lt;h3 id=&#34;2-string&#34;&gt;2. string&lt;/h3&gt;
70+
&lt;h2 id=&#34;2-string&#34;&gt;2. string&lt;/h2&gt;
7171
&lt;p&gt;string的各种操作用法千奇百怪,很多感觉几乎等效。&lt;/p&gt;
72-
&lt;h4 id=&#34;assign&#34;&gt;assign&lt;/h4&gt;
72+
&lt;h3 id=&#34;assign&#34;&gt;assign&lt;/h3&gt;
7373
&lt;p&gt;大概用法是 s1.assign(s,index,num) ,这样可以把s字符串从index索引值开始往后的num个字符赋给s1字符串。&lt;/p&gt;
7474
&lt;p&gt;基本跟substr是一样的。&lt;/p&gt;
75-
&lt;h4 id=&#34;substr&#34;&gt;substr&lt;/h4&gt;
75+
&lt;h3 id=&#34;substr&#34;&gt;substr&lt;/h3&gt;
7676
&lt;p&gt;s1=s.substr(index,num) ,这个操作跟使用assign是等效的。&lt;/p&gt;
77-
&lt;h3 id=&#34;3-for&#34;&gt;3. for&lt;/h3&gt;
77+
&lt;h2 id=&#34;3-for&#34;&gt;3. for&lt;/h2&gt;
7878
&lt;p&gt;for循环一些自动遍历的trick之前没用过。&lt;/p&gt;
7979
&lt;p&gt;比如for(auto i:nums)或者for(auto &amp;amp;i:maps),后者取值用t.first和t.second即可。也可以for(auto &amp;amp;[key,vaule]:maps)就能直接取到key和value啦。&lt;/p&gt;
8080
&lt;p&gt;&lt;strong&gt;以后随时更新&amp;hellip;&lt;/strong&gt;&lt;/p&gt;

docs/algorithm/leetcode-record-2/index.html

+16-4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@
217217

218218

219219

220+
<div class="td-toc"><nav id="TableOfContents">
221+
<ul>
222+
<li><a href="#1-一些c标准库函数">1. 一些C++标准库函数</a>
223+
<ul>
224+
<li><a href="#reverse">reverse</a></li>
225+
<li><a href="#resize">resize</a></li>
226+
<li><a href="#sort">sort</a></li>
227+
</ul>
228+
</li>
229+
</ul>
230+
</nav></div>
231+
220232

221233

222234

@@ -359,13 +371,13 @@ <h5 class="taxonomy-title">Categories:</h5>
359371
</blockquote>
360372
<p>本文内容依据我在使用c++完成各类leetcode问题时得到的有效信息和经验写成。</p>
361373
<p>P.S.可能更强调在c++的使用上而非各类逆天的算法解决方案上。</p>
362-
<h3 id="1-一些c标准库函数">1. 一些C++标准库函数</h3>
363-
<h4 id="reverse">reverse</h4>
374+
<h2 id="1-一些c标准库函数">1. 一些C++标准库函数</h2>
375+
<h3 id="reverse">reverse</h3>
364376
<p>这个好像可以用来反转很多C++支持的数据结构,一般是两个输入参量,用法大概是这样。reverse(开始位置,开始位置+需要翻转的数量),从这个角度看,它的输入参量是<strong>左闭右开</strong>的区间,例如reverse(string.begin(),string.end())&hellip;</p>
365377
<p>反正第一次用起来有点晕,极有可能c++很多的标准函数采用类似的输入形式,需要注意。</p>
366-
<h4 id="resize">resize</h4>
378+
<h3 id="resize">resize</h3>
367379
<p>反正对于字符串而言挺好使,直接resize(更新后的尺寸),可以直接把字符串扩充到指定长度,多出来的部分应该是空的吧。</p>
368-
<h4 id="sort">sort</h4>
380+
<h3 id="sort">sort</h3>
369381
<p>sort(begin(),end())这样用,反正可以直接按从小到大光速排序,这里的开始和结束参照reverse,输入是完全一样的方法。说明前面的猜想是正确的😄。</p>
370382
<p>好像还可以用自定义函数作为第三个输入参量来作为排序依据,这个等以后做题遇到的时候再写吧,没用过的东西一概不写😋。</p>
371383
<p><strong>以后随时更新&hellip;</strong></p>

docs/algorithm/leetcode-record/index.html

+19-12
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,20 @@
242242

243243
<div class="td-toc"><nav id="TableOfContents">
244244
<ul>
245-
<li>
245+
<li><a href="#1-map">1. map</a>
246246
<ul>
247-
<li><a href="#1-map">1. map</a></li>
248-
<li><a href="#2-string">2. string</a></li>
249-
<li><a href="#3-for">3. for</a></li>
247+
<li><a href="#创建">创建</a></li>
248+
<li><a href="#插入删除">插入删除</a></li>
249+
<li><a href="#查找">查找</a></li>
250250
</ul>
251251
</li>
252+
<li><a href="#2-string">2. string</a>
253+
<ul>
254+
<li><a href="#assign">assign</a></li>
255+
<li><a href="#substr">substr</a></li>
256+
</ul>
257+
</li>
258+
<li><a href="#3-for">3. for</a></li>
252259
</ul>
253260
</nav></div>
254261

@@ -394,25 +401,25 @@ <h5 class="taxonomy-title">Categories:</h5>
394401
</blockquote>
395402
<p>本文内容依据我在使用c++完成各类leetcode问题时得到的有效信息和经验写成。</p>
396403
<p>P.S.可能更强调在c++的使用上而非各类逆天的算法解决方案上。</p>
397-
<h3 id="1-map">1. map</h3>
404+
<h2 id="1-map">1. map</h2>
398405
<p>总的来说map是一个非常好用的东西,很多可以用set的问题我依然使用map来解决,感觉很舒服。</p>
399-
<h4 id="创建">创建</h4>
406+
<h3 id="创建">创建</h3>
400407
<p>创建的时候需要指定好类型 map or unordered_map &lt; type , type &gt; variable_name,创建出来是空的。拿unordered_map&lt;string,int&gt; maps来举例。</p>
401-
<h4 id="插入删除">插入删除</h4>
408+
<h3 id="插入删除">插入删除</h3>
402409
<p>对于计数型应用(反正做题比较多),即后一个type是int的情况,用起来很简单,直接maps[&ldquo;hello&rdquo;]++,这样就在创建了对应key值并+1。这里使用上<strong>值得注意</strong>,当key对应的value值减到0时,并不意味着这个key就消失了,需要maps.erase(&ldquo;hello&rdquo;)才能真正抹掉对应的key值。</p>
403410
<p>其它的应用就需要使用maps.insert(pair&lt;string,string&gt;(&ldquo;hello&rdquo;,&ldquo;world&rdquo;))来插入了。</p>
404-
<h4 id="查找">查找</h4>
411+
<h3 id="查找">查找</h3>
405412
<p>作为一个哈希表,查找是其得到使用的根本原因。</p>
406413
<p>看一个key是不是在表里, if(maps.find(&ldquo;hello&rdquo;)!=maps.end()) ,如果返回true,则说明在表里。这里的返回值是一个迭代器,迭代器这么用,maps.find(&ldquo;hello&rdquo;)-&gt;first ,这就是key的值(也就是&quot;hello&quot;),maps.find(&ldquo;hello&rdquo;)-&gt;second ,这就是&quot;hello&quot;对应的value值。</p>
407414
<p>想遍历map,也得靠迭代器,先造个迭代器,unordered_map&lt;string,int&gt;::iterator itr,然后for循环的用法就跟一般的遍历差不多了。for(itr=maps.begin();itr!=maps.end();itr++)这样就能遍历啦。</p>
408-
<h3 id="2-string">2. string</h3>
415+
<h2 id="2-string">2. string</h2>
409416
<p>string的各种操作用法千奇百怪,很多感觉几乎等效。</p>
410-
<h4 id="assign">assign</h4>
417+
<h3 id="assign">assign</h3>
411418
<p>大概用法是 s1.assign(s,index,num) ,这样可以把s字符串从index索引值开始往后的num个字符赋给s1字符串。</p>
412419
<p>基本跟substr是一样的。</p>
413-
<h4 id="substr">substr</h4>
420+
<h3 id="substr">substr</h3>
414421
<p>s1=s.substr(index,num) ,这个操作跟使用assign是等效的。</p>
415-
<h3 id="3-for">3. for</h3>
422+
<h2 id="3-for">3. for</h2>
416423
<p>for循环一些自动遍历的trick之前没用过。</p>
417424
<p>比如for(auto i:nums)或者for(auto &amp;i:maps),后者取值用t.first和t.second即可。也可以for(auto &amp;[key,vaule]:maps)就能直接取到key和value啦。</p>
418425
<p><strong>以后随时更新&hellip;</strong></p>

0 commit comments

Comments
 (0)