Skip to content

Commit

Permalink
Site updated: 2024-02-03 14:57:04
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaibineric committed Feb 3, 2024
1 parent b21095e commit b55659b
Show file tree
Hide file tree
Showing 23 changed files with 2,685 additions and 167 deletions.
10 changes: 6 additions & 4 deletions 2023/11/27/go-基础/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<meta property="og:image" content="https://gitee.com/lihaibineric/picgo/raw/master/pic/image-20231207215514980.png">
<meta property="og:image" content="https://gitee.com/lihaibineric/picgo/raw/master/pic/image-20231207215859488.png">
<meta property="article:published_time" content="2023-11-27T12:41:11.000Z">
<meta property="article:modified_time" content="2024-01-27T10:06:53.416Z">
<meta property="article:modified_time" content="2024-02-03T03:04:55.418Z">
<meta property="article:author" content="Haibin Li">
<meta property="article:tag" content="后端开发">
<meta name="twitter:card" content="summary_large_image">
Expand Down Expand Up @@ -227,7 +227,7 @@
<span class="post-meta mr-2">
<i class="iconfont icon-chart"></i>

24k words
25k words

</span>

Expand Down Expand Up @@ -280,7 +280,7 @@ <h1 id="seo-header">【后端开发】Golang语法基础</h1>
<p class="note note-info">


Last updated on January 27, 2024 pm
Last updated on February 3, 2024 am


</p>
Expand Down Expand Up @@ -426,6 +426,8 @@ <h3 id="go111module">GO111MODULE</h3>
</ul>
<p>执行以下命令开启go mod管理</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">go <span class="hljs-built_in">env</span> -w GO111MODULE=on<br></code></pre></td></tr></table></figure>
<p>Go mod操作</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">go mod init github.com/hub/project<br></code></pre></td></tr></table></figure>
<h2 id="go基本语法">Go基本语法</h2>
<h3 id="如何编译并运行一个go文件">如何编译并运行一个Go文件</h3>
<p>对于已经写好的go文件,这里以hello.go作为例子,直接使用以下语句进行编译并运行</p>
Expand Down Expand Up @@ -851,7 +853,7 @@ <h3 id="结构体标签">结构体标签</h3>

<div class="license-meta-item license-meta-date">
<div>Updated on</div>
<div>January 27, 2024</div>
<div>February 3, 2024</div>
</div>


Expand Down
3 changes: 2 additions & 1 deletion 2024/01/01/leetcode/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<meta property="og:image" content="https://gitee.com/lihaibineric/picgo/raw/master/pic/image-20240128143004648.png">
<meta property="og:image" content="https://gitee.com/lihaibineric/picgo/raw/master/pic/image-20240129130942760.png">
<meta property="article:published_time" content="2024-01-01T13:15:17.000Z">
<meta property="article:modified_time" content="2024-01-30T12:48:50.193Z">
<meta property="article:modified_time" content="2024-01-30T14:38:01.579Z">
<meta property="article:author" content="Haibin Li">
<meta property="article:tag" content="算法题">
<meta property="article:tag" content="leetcode">
Expand Down Expand Up @@ -1186,6 +1186,7 @@ <h3 id="每日温度">每日温度</h3>
<figure class="highlight dns"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs dns">输入: temperatures = [<span class="hljs-number">73,74,75,71</span>,<span class="hljs-number">69,72,76,73</span>]<br>输出: [<span class="hljs-number">1,1,4,2</span>,<span class="hljs-number">1,1,0,0</span>]<br></code></pre></td></tr></table></figure>
<p>思路:</p>
<p>可以选择使用<strong>单调栈的方法</strong>来求解,具体的思路是设置一个栈,遍历数组的时候和栈顶元素进行比较,小于栈顶元素的时候就需要将当前元素放入栈中</p>
<p>首先这道题必须有一个向量数组来存储对应位置的元素的值,<code>vector&lt;int&gt; res(temperatures.size(),0)</code>方便修改对应的元素</p>
<p>如果大于当前的栈顶元素的值,那么就要进行比较<code>while</code>循环,只要还是大于当前栈顶的元素都需要对栈顶的元素进行<code>pop()</code></p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><code class="hljs cpp"><span class="hljs-keyword">class</span> <span class="hljs-title class_">Solution</span> &#123;<br><span class="hljs-keyword">public</span>:<br> <span class="hljs-function">vector&lt;<span class="hljs-type">int</span>&gt; <span class="hljs-title">dailyTemperatures</span><span class="hljs-params">(vector&lt;<span class="hljs-type">int</span>&gt;&amp; temperatures)</span> </span>&#123;<br> stack&lt;<span class="hljs-type">int</span>&gt; st;<br> <span class="hljs-function">vector&lt;<span class="hljs-type">int</span>&gt; <span class="hljs-title">res</span><span class="hljs-params">(temperatures.size(),<span class="hljs-number">0</span>)</span></span>;<br> st.<span class="hljs-built_in">push</span>(<span class="hljs-number">0</span>);<br> <span class="hljs-keyword">for</span>(<span class="hljs-type">int</span> i=<span class="hljs-number">1</span>;i&lt;temperatures.<span class="hljs-built_in">size</span>();i++)&#123;<br> <span class="hljs-keyword">if</span>(temperatures[i]&lt;=temperatures[st.<span class="hljs-built_in">top</span>()])&#123;<br> st.<span class="hljs-built_in">push</span>(i);<br> &#125;<span class="hljs-keyword">else</span>&#123;<br> <span class="hljs-keyword">while</span> (!st.<span class="hljs-built_in">empty</span>()&amp;&amp; temperatures[i]&gt;temperatures[st.<span class="hljs-built_in">top</span>()])&#123;<br> res[st.<span class="hljs-built_in">top</span>()]=i-st.<span class="hljs-built_in">top</span>();<br> st.<span class="hljs-built_in">pop</span>();<br> &#125;<br> st.<span class="hljs-built_in">push</span>(i);<br> &#125;<br> &#125;<br> <span class="hljs-keyword">return</span> res;<br> &#125;<br>&#125;;<br></code></pre></td></tr></table></figure>
<h1 id="图论">图论</h1>
Expand Down
6 changes: 6 additions & 0 deletions 2024/01/23/go-kit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@ <h2 id="实际运行结果">实际运行结果</h2>
<article class="post-prev col-6">


<a href="/2024/01/30/deepl/" title="deepl">
<i class="iconfont icon-arrowleft"></i>
<span class="hidden-mobile">deepl</span>
<span class="visible-mobile">Previous</span>
</a>

</article>
<article class="post-next col-6">

Expand Down
Loading

0 comments on commit b55659b

Please sign in to comment.