Skip to content

Commit

Permalink
chore: refine ioi
Browse files Browse the repository at this point in the history
  • Loading branch information
alomerry committed Oct 28, 2023
1 parent f748869 commit d15587b
Show file tree
Hide file tree
Showing 70 changed files with 88 additions and 96 deletions.
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/1.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ public:
### 哈希法
@[code](@IOI/1-map.go)
@IOI/1-map.go
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/100.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Output: false

Language: **Go**

@[code](@IOI/100-main.cpp)
@IOI/100-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/101.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Output: false

Language: **Go**

@[code](@IOI/101-main.cpp)
@IOI/101-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/104.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Output: 2

Language: **Go**

@[code](@IOI/104-main.cpp)
@IOI/104-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/13.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.

Language: **Go**

@[code](@IOI/13-main.cpp)
@IOI/13-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/14.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ Language: **Go**

分而治之

@[code](@IOI/14-main.cpp)
@IOI/14-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/169.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Related Topics: [数组](https://leetcode.cn/tag/https://leetcode.cn/tag/array//

Language: **Go**

@[code](@IOI/169-main.go)
@IOI/169-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/1920.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ ans = [nums[nums[0]], nums[nums[1]], nums[nums[2]], nums[nums[3]], nums[nums[4]]

Language: **Go**

@[code](@IOI/1920-main.cpp)
@IOI/1920-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/20.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Output: false

Language: **Go**

@[code](@IOI/20-stack.cpp)
@IOI/20-stack.cpp
4 changes: 2 additions & 2 deletions ioi/leetcode-easy/21.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ Output: [0]

Language: **Go**

@[code](@IOI/21-dp.cpp)
@IOI/21-dp.cpp

@[code](@IOI/21-main.cpp)
@IOI/21-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/2525.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Related Topics: [数学](https://leetcode.cn/tag/https://leetcode.cn/tag/math//)

Language: **Go**

@[code](@IOI/2525.go)
@IOI/2525.go
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/2562.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ nums 只有一个元素,所以我们选中 13 并将其加到串联值上,

Language: **Go**

@[code](@IOI/2562.go)
@IOI/2562.go
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/2578.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ Related Topics: [贪心](https://leetcode.cn/tag/https://leetcode.cn/tag/greedy/

Language: **Golang**

@[code](@IOI/2578.go)
@IOI/2578.go
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/26.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ It does not matter what you leave beyond the returned k (hence they are undersco

Language: **Go**

@[code](@IOI/26-main.cpp)
@IOI/26-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/27.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ It does not matter what you leave beyond the returned k (hence they are undersco

Language: **Go**

@[code](@IOI/27-main.cpp)
@IOI/27-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/53.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ Explanation: The subarray [5,4,-1,7,8] has the largest sum 23.
Language: **Go**


@[code](@IOI/53-main.cpp)
@IOI/53-main.cpp
4 changes: 2 additions & 2 deletions ioi/leetcode-easy/58.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ Explanation: The last word is "joyboy" with length 6.

Language: **Go**

@[code](@IOI/58-main.cpp)
@IOI/58-main.cpp

@[code](@IOI/58-index.cpp)
@IOI/58-index.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/66.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ Thus, the result should be [1,0].

Language: **Go**

@[code](@IOI/66-main.cpp)
@IOI/66-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/67.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Output: "10101"

Language: **Go**

@[code](@IOI/67-main.cpp)
@IOI/67-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/69.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Explanation: The square root of 8 is 2.82842..., and since we round it down to t

Language: **Go**

@[code](@IOI/69-main.cpp)
@IOI/69-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/7.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Output: 21

Language: **Go**

@[code](@IOI/7-main.cpp)
@IOI/7-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/70.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ Explanation: There are three ways to climb to the top.

Language: **Go**

@[code](@IOI/70-main.cpp)
@IOI/70-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/83.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Output: [1,2,3]

Language: **Go**

@[code](@IOI/83-main.cpp)
@IOI/83-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-easy/88.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Note that because m = 0, there are no elements in nums1\. The 0 is only there to

Language: **Go**

@[code](@IOI/88-main.cpp)
@IOI/88-main.cpp
12 changes: 3 additions & 9 deletions ioi/leetcode-easy/9.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ Difficulty: **简单**
Related Topics: [Math](https://leetcode.cn/tag/https://leetcode.cn/tag/math//)


Given an integer `x`, return `true` _if_ `x` _is a_<span data-keyword="palindrome-integer" class=" cursor-pointer relative text-dark-blue-s text-sm"></span>


_**palindrome**_


_, and_ `false` _otherwise_.
Given an integer `x`, return `true` if `x` is a _**palindrome**_, and `false` otherwise.

**Example 1:**

Expand Down Expand Up @@ -50,6 +44,6 @@ Explanation: Reads 01 from right to left. Therefore it is not a palindrome.
Language: **Go**


@[code](@IOI/9-main.cpp)
@IOI/9-main.cpp

@[code](@IOI/9-string.cpp)
@IOI/9-string.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-hard/10.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ Explanation: ".*" means "zero or more (*) of any character (.)".

Language: **Go**

@[code](@IOI/10-main.cpp)
@IOI/10-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-hard/23.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ Language: **Go**
中查询出等值的链表 index(使用 queue 保存),依次将链表元素取出。边界是当
set 中不存在元素时所有链表取完。

@[code](@IOI/23-main.cpp)
@IOI/23-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-hard/25.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Related Topics: [递归](https://leetcode.cn/tag/recursion/), [链表](https://l

Language: **Go**

[@code go](@IOI/25-main.go)
@IOI/25-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-hard/28.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Explanation: "leeto" did not occur in "leetcode", so we return -1.

Language: **Go**

@[code](@IOI/28-main.go)
@IOI/28-main.go
14 changes: 7 additions & 7 deletions ioi/leetcode-hard/4.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,28 @@ Related Topics: [数组](https://leetcode.cn/tag/array/), [二分查找](https:/

要取得中位数,只需要将两条数组合并并排序,如果数组长度为偶数,则去中间两个取平均值,否则去中间的数即可。

@[code](@IOI/4-merge-and-sort.go)
@IOI/4-merge-and-sort.go

### 冒泡排序

@[code](../../../../algorithm/code/base/sort/bubble_sort.go)
../../../../algorithm/code/base/sort/bubble_sort.go)

### 选择排序

@[code](../../../../algorithm/code/base/sort/select_sort.go)
../../../../algorithm/code/base/sort/select_sort.go)

### 插入排序

@[code](../../../../algorithm/code/base/sort/insert_sort.go)
../../../../algorithm/code/base/sort/insert_sort.go)

### 归并排序

@[code](../../../../algorithm/code/base/sort/merge_sort.go)
../../../../algorithm/code/base/sort/merge_sort.go)

### 堆排序

@[code](../../../../algorithm/code/base/sort/heap_sort.go)
../../../../algorithm/code/base/sort/heap_sort.go)

### 快速排序

@[code](../../../../algorithm/code/base/sort/quick_sort.go)
../../../../algorithm/code/base/sort/quick_sort.go)
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/102.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Output: []

Language: **Go**

@[code](@IOI/102-main.cpp)
@IOI/102-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/105.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ Output: [-1]

Language: **Go**

@[code](@IOI/105-main.cpp)
@IOI/105-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/106.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ Output: [-1]

Language: **Go**

@[code](@IOI/106-main.cpp)
@IOI/106-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/107.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Output: []

Language: **Go**

@[code](@IOI/107-main.cpp)
@IOI/107-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/11.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ Output: 1

Language: **Go**

@[code](@IOI/11-main.cpp)
@IOI/11-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/12.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.

Language: **Go**

@[code](@IOI/12-map.cpp)
@IOI/12-map.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/147.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Related Topics: [链表](https://leetcode.cn/tag/linked-list/), [排序](https:/

Language: **Go**

@[code](@IOI/147-main.go)
@IOI/147-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/15.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ Explanation: The only possible triplet sums up to 0.

Language: **Go**

@[code](@IOI/15-main.cpp)
@IOI/15-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/16.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ Explanation: The sum that is closest to the target is 0\. (0 + 0 + 0 = 0).

Language: **Go**

@[code](@IOI/16-main.cpp)
@IOI/16-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/17.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Language: **Go**

递归遍历

@[code](@IOI/17-main.go)
@IOI/17-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/18.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Language: **Go**

定边双指针法:固定两边,指针 i、j 从两边向内计算,如果当前四数之和大于(小于)target,则移动 j(i)想中间靠拢。为了防止超时,需要进行一定的剪枝:当 i、j 确定出一个 target 的解,则需要移动 i、j,移动时需要保证新的 nums[i]、nums[j] 的值是变化了的,否则无论是哪一个值变动都只能让总和更小或者更大,同时也能避免计算了相同解。

@[code](@IOI/18-main.cpp)
@IOI/18-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/189.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Related Topics: [数组](https://leetcode.cn/tag/https://leetcode.cn/tag/array//

Language: **Go**

@[code](@IOI/189-main.go)
@IOI/189-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/19.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Language: **Go**

空间替换时间:使用 map 记录“链”。key 为链表的序号,value 记录 next。删除倒数 n 个数字时,只需要将 n-1 的 value 指向 n+1 即可。

@[code](@IOI/19-main.cpp)
@IOI/19-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/2.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Related Topics: [递归](https://leetcode.cn/tag/recursion/), [链表](https://l

### 暴力法

@[code](@IOI/2-violence.go)
@IOI/2-violence.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/207.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ To take course 1 you should have finished course 0, and to take course 0 you sho

Language: **Go**

@[code](@IOI/207-topo.cpp)
@IOI/207-topo.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/22.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ Output: ["()"]

Language: **Go**

@[code](@IOI/22-main.go)
@IOI/22-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/2316.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ Language: **Go**

并查集

@[code](@IOI/2316.go)
@IOI/2316.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/24.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Output: [1]

Language: **Go**

@[code](@IOI/24-main.go)
@IOI/24-main.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/2512.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ Related Topics: [数组](https://leetcode.cn/tag/https://leetcode.cn/tag/array//

Language: **Go**

@[code](@IOI/2512.go)
@IOI/2512.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/3.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ Related Topics: [哈希表](https://leetcode.cn/tag/hash-table/), [字符串](ht

依次将原始串中的字符 push 到队列,同时将该字符标记为已存在。在 push 前验证当前字符是否存在,已存在则依次将队头 pop,知道当前字符不存在。在 push 后验证当前队列的子串长度是否比已经记录的 max 值大。

@[code](@IOI/3-queue.go)
@IOI/3-queue.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/33.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ Output: -1

Language: **Go**

@[code](@IOI/33-main.cpp)
@IOI/33-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/35.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Output: 4

Language: **Go**

@[code](@IOI/35-main.cpp)
@IOI/35-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/5.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Related Topics: [字符串](https://leetcode.cn/tag/string/), [动态规划](htt

### 动态规划

@[code](@IOI/5-dp.go)
@IOI/5-dp.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/6.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ Output: "A"

Language: **Go**

@[code](@IOI/6-main.cpp)
@IOI/6-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/61.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Related Topics: [链表](https://leetcode.cn/tag/https://leetcode.cn/tag/linked-

Language: **Go**

@[code](@IOI/61.go)
@IOI/61.go
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/721.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ Output: [["Ethan","Ethan0@m.co","Ethan4@m.co","Ethan5@m.co"],["Gabe","Gabe0@m.co

Language: **Go**

@[code](@IOI/721-main.cpp)
@IOI/721-main.cpp
2 changes: 1 addition & 1 deletion ioi/leetcode-medium/8.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ Since 4193 is in the range [-231, 231 - 1], the final result is 4193.

Language: **Go**

@[code](@IOI/8-main.cpp)
@IOI/8-main.cpp
Loading

0 comments on commit d15587b

Please sign in to comment.