<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title></title>
    <link>https://bugxyb.github.io</link>
    <atom:link href="https://bugxyb.github.io/feed.xml" rel="self" type="application/rss+xml" />
    <description></description>
    <language>en-us</language>
    <pubDate>Sat, 13 Nov 2021 16:34:18 +0000</pubDate>
    <lastBuildDate>Sat, 13 Nov 2021 16:34:18 +0000</lastBuildDate>

    
      <item>
        <title>LeetCode Biweekly Contest 65</title>
        <link>https://bugxyb.github.io/LeetCode-Biweekly-Contest-65</link>
        <pubDate>Sun, 14 Nov 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;心态崩了，第二题太坑，然后键盘出问题，连删三次代码，哭泣&lt;/p&gt;

&lt;h1 id=&quot;t1-check-whether-two-strings-are-almost-equivalent&quot;&gt;T1: Check Whether Two Strings are Almost Equivalent&lt;/h1&gt;
&lt;p&gt;模拟统计即可&lt;/p&gt;

&lt;h1 id=&quot;t2-walking-robot-simulation-ii&quot;&gt;T2: Walking Robot Simulation II&lt;/h1&gt;
&lt;p&gt;模拟操作，然后可以优化多次循环操作，但是至少要留一次循环（因为方向问题）&lt;/p&gt;

&lt;h1 id=&quot;t3-most-beautiful-item-for-each-query&quot;&gt;T3: Most Beautiful item for Each Query&lt;/h1&gt;
&lt;p&gt;排序后进行统计询问即可&lt;/p&gt;

&lt;h1 id=&quot;t4-maximum-number-of-tasks-you-can-assign&quot;&gt;T4: Maximum Number of Tasks You Can Assign&lt;/h1&gt;
&lt;p&gt;无论怎么样，完成的Tasks一定是前面力量最小的。所以二分答案，然后判断是否能完成：
如果直接完成就完成，不能就找个能吃药的完成进行判断即可，通过TreeMap来统计。&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Weekly Contest 266</title>
        <link>https://bugxyb.github.io/LeetCode-Weekly-Contest-266</link>
        <pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;由于搬家，所以上周比赛没有参加，今天比赛难度简单，找回状态中（状态偏不行）&lt;/p&gt;

&lt;h1 id=&quot;t1-count-vowel-substrings-of-a-string&quot;&gt;T1: Count Vowel SubStrings of a String&lt;/h1&gt;
&lt;p&gt;直接枚举统计即可，注意是子串有且只有5种字符&lt;/p&gt;

&lt;h1 id=&quot;t2-vowels-of-all-substrings&quot;&gt;T2: Vowels of All Substrings&lt;/h1&gt;
&lt;p&gt;找到对应的Vowel字符，然后计算出包含这个字符由多少个子串即可，数学统计计算&lt;/p&gt;

&lt;h1 id=&quot;t3-minimized-maximum-of-products-distributed-to-any-store&quot;&gt;T3: Minimized Maximum of Products Distributed to Any Store&lt;/h1&gt;
&lt;p&gt;二分答案，判断答案是否ok&lt;/p&gt;

&lt;h1 id=&quot;t4-maximum-path-quality-of-a-graph&quot;&gt;T4: Maximum Path Quality of a Graph&lt;/h1&gt;
&lt;p&gt;搜索即可，因为maxTime/Time最大是10，所以最多枚举10步即可，而且每个点最多只有4条边，
后面可以做个优化就是判断这个点回0的最小时间，因为终点要为0&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Weekly Contest 264</title>
        <link>https://bugxyb.github.io/LeetCode-Weekly-Contest-264</link>
        <pubDate>Sun, 24 Oct 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;第一题字符串处理的题又臭又长，真的很讨厌，导致罚时有点可怕&lt;/p&gt;

&lt;h1 id=&quot;t1-number-of-valid-words-in-a-sentence&quot;&gt;T1: Number of Valid Words in a Sentence&lt;/h1&gt;
&lt;p&gt;根据题目意思进行字符串处理匹配，注意处理-这个符号的要求&lt;/p&gt;

&lt;h1 id=&quot;t2-next-greater-numerically-balanced-number&quot;&gt;T2: Next Greater Numerically Balanced Number&lt;/h1&gt;
&lt;p&gt;根据数字直接暴力模拟遍历即可。&lt;/p&gt;

&lt;h1 id=&quot;t3-count-nodes-with-the-highest-score&quot;&gt;T3: Count Nodes With the Highest Score&lt;/h1&gt;
&lt;p&gt;树遍历统计，注意中间的乘积结果会超过Integer，需要用Long&lt;/p&gt;

&lt;h1 id=&quot;t4-parallel-courses-iii&quot;&gt;T4: Parallel Courses III&lt;/h1&gt;
&lt;p&gt;遍历即可，然后求出每个课程的最大值&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Weekly Contest 263</title>
        <link>https://bugxyb.github.io/LeetCode-Weekly-Contest-263</link>
        <pubDate>Sun, 17 Oct 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;今天题目比较偏弱，只不过最后一题被罚时有点可惜，掉出了前100，
如果不被罚时，说不定能进前50&lt;/p&gt;

&lt;h1 id=&quot;t1-check-if-numbers-are-ascending-in-a-sentence&quot;&gt;T1: Check if Numbers Are Ascending in a Sentence&lt;/h1&gt;
&lt;p&gt;空格字符串分离，判断是不是数字，再判断是否递增即可&lt;/p&gt;

&lt;h1 id=&quot;t2-simple-bank-system&quot;&gt;T2: Simple Bank System&lt;/h1&gt;
&lt;p&gt;简单的加减模拟器，注意不为负和用户操作边界判断&lt;/p&gt;

&lt;h1 id=&quot;t3-count-number-of-maximum-bitwise-or-subsets&quot;&gt;T3: Count Number of Maximum Bitwise-OR subsets&lt;/h1&gt;
&lt;p&gt;深搜即可&lt;/p&gt;

&lt;h1 id=&quot;t4-second-minimum-time-to-reach-destination&quot;&gt;T4: Second Minimum Time to Reach Destination&lt;/h1&gt;
&lt;p&gt;可以理解为双层图的路径，第一层是最快的到达时间，第二层是第二快的时间(两者不能相等），
然后直接用优先队列解决即可，注意剪枝。&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Biweekly Contest 63</title>
        <link>https://bugxyb.github.io/LeetCode-Biweekly-Contest-63</link>
        <pubDate>Sat, 16 Oct 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;第四题稍微有点难度，前三题偏弱，但是第四题自己想了比较久&lt;/p&gt;

&lt;h1 id=&quot;t1-minimum-number-of-moves-to-seat-everyone&quot;&gt;T1: Minimum Number of Moves to Seat Everyone&lt;/h1&gt;
&lt;p&gt;排序后依次求绝对值之和&lt;/p&gt;

&lt;h1 id=&quot;t2-remove-colored-pieces-if-both-neighbors-are-the-same-color&quot;&gt;T2: Remove Colored Pieces if Both Neighbors are the Same Color&lt;/h1&gt;
&lt;p&gt;分别计算Alice和Bob可以移除颜色的数量，返回Alice &amp;gt;= Bob即可&lt;/p&gt;

&lt;h1 id=&quot;t3-the-time-when-the-network-becomes-idle&quot;&gt;T3: The Time When the Network Becomes Idle&lt;/h1&gt;
&lt;p&gt;计算每个结点到0的时间为N，计算在2&lt;em&gt;N的时间内最后一次发送的时间为T，取T+2&lt;/em&gt;N+1的最大值即可&lt;/p&gt;

&lt;h1 id=&quot;t4-kth-smallest-product-of-two-sorted-arrays&quot;&gt;T4: Kth Smallest Product of Two Sorted Arrays&lt;/h1&gt;
&lt;p&gt;对于两个数组先计算负数，0和正数的数量，求出最终数字是正数还是负数（或者是0）。
切换成两组递增（递减）的数组，通过二分来计算目标数值即可。&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Weekly Contest 262</title>
        <link>https://bugxyb.github.io/LeetCode-Weekly-Contest-262</link>
        <pubDate>Sun, 10 Oct 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;整个人傻乎乎的，虽然全部做完了，但是时间整个人都是懵逼的，前三题耗时太长了。&lt;/p&gt;

&lt;h1 id=&quot;t1-two-out-of-three&quot;&gt;T1: Two out of Three&lt;/h1&gt;
&lt;p&gt;用二进制表示3个数组的位置，找出1出现2次以上的即可&lt;/p&gt;

&lt;h1 id=&quot;t2-minimum-operations-to-make-a-uni-value-grid&quot;&gt;T2: Minimum Operations to Make a Uni-Value Grid&lt;/h1&gt;
&lt;p&gt;映射到线性空间上，然后O（n）计算求解，求解前先判断是否正常&lt;/p&gt;

&lt;h1 id=&quot;t3-stock-price-fluctuation&quot;&gt;T3: Stock Price Fluctuation&lt;/h1&gt;
&lt;p&gt;使用TreeSet即可，可以直接使用Long（当时傻掉了）来组合Timestamp和Price&lt;/p&gt;

&lt;h1 id=&quot;t4-partition-array-into-two-arrays-to-minimize-sum-difference&quot;&gt;T4: Partition Array Into Two Arrays to Minimize Sum Difference&lt;/h1&gt;
&lt;p&gt;假设数组总和为sum，那么找一个a,满足sum-2&lt;em&gt;a最小，且2&lt;/em&gt;a小于等于sum（如果sum为负数，可以转换成正数）
假设数组长度是2*n，拆成两个n长度的数组，进行计算求和。转换成
2个数组集合，第一个集合找出k个数，第二个集合找出n-k个数，且满足这两个数相加
的和符合前面的条件，可以排序线性扫描计算&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Weekly Contest 261</title>
        <link>https://bugxyb.github.io/LeetCode-Weekly-Contest-261</link>
        <pubDate>Sun, 03 Oct 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;最后一题尴尬卡住（不会做）&lt;/p&gt;

&lt;h1 id=&quot;t1-minimum-moves-to-convert-string&quot;&gt;T1: Minimum Moves to Convert String&lt;/h1&gt;
&lt;p&gt;枚举，暴力计算即可&lt;/p&gt;

&lt;h1 id=&quot;t2-find-missing-observations&quot;&gt;T2: Find Missing Observations&lt;/h1&gt;
&lt;p&gt;先判断是否合理，然后优先填充1和6&lt;/p&gt;

&lt;h1 id=&quot;t3-stone-game-ix&quot;&gt;T3: Stone Game IX&lt;/h1&gt;
&lt;p&gt;对三取余进行统计，也就是余为0，1，2的数字集合，然后进行判断：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;如果余1，2都为0，那么bob赢&lt;/li&gt;
  &lt;li&gt;如果余1，2相等，那么看0是奇数还是偶数，如果是偶数，那么alice赢&lt;/li&gt;
  &lt;li&gt;取余1，2最小的，如果大于0且是偶数，那么alice赢&lt;/li&gt;
  &lt;li&gt;去余1，2的差值，如果小于3那么bob赢&lt;/li&gt;
  &lt;li&gt;最后看余0如果为奇数alice赢&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;t4-smallest-k-length-subsequence-with-occurences-of-a-letter&quot;&gt;T4: Smallest K-Length Subsequence With Occurences of a Letter&lt;/h1&gt;
&lt;p&gt;利用栈的方法解决，这题我不会，详细看代码&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;smallestSubsequence&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repetition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nLetter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toCharArray&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nLetter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;Stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Character&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;charAt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;isEmpty&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;peek&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;peek&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()!=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nLetter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;repetition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repetition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++;&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
                    &lt;span class=&quot;n&quot;&gt;repetition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--;&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repetition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
                    &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;letter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nLetter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;--;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nc&quot;&gt;StringBuilder&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StringBuilder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Character&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stack&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toString&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Biweekly Contest 62</title>
        <link>https://bugxyb.github.io/LeetCode-Biweekly-Contest-62</link>
        <pubDate>Sat, 02 Oct 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;上周比赛没打（折腾人），今天比赛比较简单，最后一题比较迟钝&lt;/p&gt;

&lt;h1 id=&quot;t1-convert-1d-array-into-2d-array&quot;&gt;T1: Convert 1D Array Into 2D Array&lt;/h1&gt;
&lt;p&gt;先判断是否可行再暴力模拟即可&lt;/p&gt;

&lt;h1 id=&quot;t2-number-of-pairs-of-strings-with-concatenation-equal-to-target&quot;&gt;T2: Number of Pairs of Strings With Concatenation Equal to Target&lt;/h1&gt;
&lt;p&gt;枚举暴力即可&lt;/p&gt;

&lt;h1 id=&quot;t3-maximize-the-confusion-of-an-exam&quot;&gt;T3: Maximize the Confusion of an Exam&lt;/h1&gt;
&lt;p&gt;分别计算转成T或者转成F，求两者最大值。可以直接用线性扫描O（N）复杂度解决。&lt;/p&gt;

&lt;h1 id=&quot;t4-maximum-number-of-ways-to-parition-an-array&quot;&gt;T4: Maximum Number of Ways to Parition an Array&lt;/h1&gt;
&lt;p&gt;假设等式替换为Left-Right，枚举某个数进行变动，那么如果这个数在等式左侧，那么
左侧Left为变动为k-num，那么只需要知道左侧这部分差值为k-num，同理右侧也是，两者
求和即可&lt;/p&gt;
&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;waysToPartition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Long&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Long&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Integer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lmap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;HashMap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;gt;();&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;num&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;num&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;right&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;right&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;left&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getOrDefault&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getOrDefault&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;l&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cnt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;long&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;diff&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;k&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Math&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getOrDefault&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getOrDefault&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;diff&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;lmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;put&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;getOrDefault&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ans&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Weekly Contest 259</title>
        <link>https://bugxyb.github.io/LeetCode-Weekly-Contest-259</link>
        <pubDate>Sun, 19 Sep 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;最后一题有点大失所望，好像直接莽过去就行了&lt;/p&gt;

&lt;h1 id=&quot;t1-find-value-of-variable-after-performing-operations&quot;&gt;T1: Find Value of Variable After Performing Operations&lt;/h1&gt;
&lt;p&gt;枚举4个操作判断即可&lt;/p&gt;

&lt;h1 id=&quot;t2-sum-of-beauty-in-the-array&quot;&gt;T2: Sum of Beauty in the Array&lt;/h1&gt;
&lt;p&gt;O(n)复杂度，记录左边最大值，右边最小值判断即可&lt;/p&gt;

&lt;h1 id=&quot;t3-detect-squares&quot;&gt;T3: Detect Squares&lt;/h1&gt;
&lt;p&gt;枚举正方形长度，判断3个角有没有point&lt;/p&gt;

&lt;h1 id=&quot;t4-longest-subsequence-repeated-k-times&quot;&gt;T4: Longest Subsequence Repeated k Times&lt;/h1&gt;
&lt;p&gt;暴力莽就行，如果某个子串至少出现k次，那么这个子串前面的也至少出现k次。
做好判重查询即可，注意不是出现K次，是至少k次&lt;/p&gt;
</description>
      </item>
    
      <item>
        <title>LeetCode Biweekly Contest 61</title>
        <link>https://bugxyb.github.io/LeetCode-Biweekly-Contest-61</link>
        <pubDate>Sat, 18 Sep 2021 00:00:00 +0000</pubDate>
        <author></author>
        <description>&lt;p&gt;第一次30min解决战斗，奈何罚时太狠了，自己失误率过高&lt;/p&gt;

&lt;h1 id=&quot;t1-count-number-of-pairs-with-absolute-difference-k&quot;&gt;T1: Count Number of Pairs With Absolute Difference K&lt;/h1&gt;
&lt;p&gt;模拟即可&lt;/p&gt;

&lt;h1 id=&quot;t2-find-original-array-from-doubled-array&quot;&gt;T2: Find Original Array From Doubled Array&lt;/h1&gt;
&lt;p&gt;罚时题*1，基数排序，然后模拟判断是否拆分两个数组，第一个是第二个的double即可。&lt;/p&gt;

&lt;h1 id=&quot;t3-maximum-earnings-from-taxi&quot;&gt;T3: Maximum Earnings From Taxi&lt;/h1&gt;
&lt;p&gt;DP题，按时间模拟即可，对Rides进行排序即可&lt;/p&gt;

&lt;h1 id=&quot;t4-minimum-number-of-operations-to-make-array-continuous&quot;&gt;T4: Minimum Number of Operations to Make Array Continuous&lt;/h1&gt;
&lt;p&gt;注意重复，首选去重，去重的个数都是需要修改的。枚举开始的x，记录[x,x+n)这个区间
内有多少个去重后的数，答案就是n-这个值即可。&lt;/p&gt;
</description>
      </item>
    

  </channel>
</rss>
