Skip to content

Commit 2b6fa0e

Browse files
committed
rename dir name called digitals prefix
1 parent 5c7ee80 commit 2b6fa0e

File tree

24 files changed

+121
-22
lines changed

24 files changed

+121
-22
lines changed

two-sum/main.go 1.two-sum/main.go

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

622.design-circular-queue/main.go

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package main
2+
3+
type Node struct {
4+
value int
5+
next *Node
6+
}
7+
8+
type MyCircularQueue struct {
9+
headNode *Node
10+
rearNode *Node
11+
size int
12+
capacity int
13+
}
14+
15+
func Constructor(k int) MyCircularQueue {
16+
return MyCircularQueue{
17+
headNode: nil,
18+
rearNode: nil,
19+
size: 0,
20+
capacity: k,
21+
}
22+
}
23+
24+
func (this *MyCircularQueue) EnQueue(value int) bool {
25+
26+
if this.IsFull() {
27+
return false
28+
}
29+
30+
enNode := Node{
31+
value: value,
32+
next: nil,
33+
}
34+
35+
// If headNode is nil, headNode and rearNode equals enNode
36+
if this.IsEmpty() {
37+
this.headNode = &enNode
38+
this.rearNode = &enNode
39+
} else {
40+
// origin rearNode next point is enNode, and new rearNode is EnNode
41+
this.rearNode.next = &enNode
42+
this.rearNode = &enNode
43+
}
44+
45+
this.size++
46+
47+
return true
48+
}
49+
50+
func (this *MyCircularQueue) DeQueue() bool {
51+
if this.IsEmpty() {
52+
return false
53+
}
54+
this.headNode = this.headNode.next
55+
this.size--
56+
57+
if this.IsEmpty() {
58+
this.rearNode = nil
59+
}
60+
return true
61+
}
62+
63+
func (this *MyCircularQueue) Front() int {
64+
65+
if this.IsEmpty() {
66+
return -1
67+
}
68+
return this.headNode.value
69+
}
70+
71+
func (this *MyCircularQueue) Rear() int {
72+
if this.IsEmpty() {
73+
return -1
74+
}
75+
return this.rearNode.value
76+
}
77+
78+
func (this *MyCircularQueue) IsEmpty() bool {
79+
return this.size == 0
80+
}
81+
82+
func (this *MyCircularQueue) IsFull() bool {
83+
return this.size == this.capacity
84+
}
85+
86+
/**
87+
* Your MyCircularQueue object will be instantiated and called as such:
88+
* obj := Constructor(k);
89+
* param_1 := obj.EnQueue(value);
90+
* param_2 := obj.DeQueue();
91+
* param_3 := obj.Front();
92+
* param_4 := obj.Rear();
93+
* param_5 := obj.IsEmpty();
94+
* param_6 := obj.IsFull();
95+
*/
96+
97+
func main() {
98+
99+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
44
| 序号 | 题目名称 | 难度 | 地址 | 进度 |
55
|----|----|----|----|----|
6-
| 1 | [两数之和](./two-sum/main.go)| 简单 | https://leetcode.cn/problems/two-sum/ | 已完成 |
7-
| 9 | [回文数](./palindrome-number/main.go)| 简单 | https://leetcode.cn/problems/palindrome-number/ | 已完成 |
8-
| 21| [合并两个有序链表](./merge-two-sorted-lists/main.go) | 简单 | https://leetcode.cn/problems/merge-two-sorted-lists/ | 已完成 |
9-
| 26 | [删除有序数组中的重复项](./remove-duplicates-from-sorted-array/main.go) | 简单 | https://leetcode.cn/problems/remove-duplicates-from-sorted-array/ | 已完成 |
10-
| 66 | [加一](./plus-one/main.go) | 简单 | https://leetcode.cn/problems/plus-one/ | 已完成 |
11-
| 83 | [删除排序链表中的重复元素](./remove-duplicates-from-sorted-list/main.go) | 简单 | https://leetcode.cn/problems/remove-duplicates-from-sorted-list/ | 已完成 |
12-
| 122 | [买卖股票的最佳时机 II](./single-number/main.go) | 中等 | https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/ | 已完成 |
13-
| 136 | [只出现一次的数字](./single-number/main.go) | 简单 | https://leetcode.cn/problems/single-number/ | 已完成 |
14-
| 141 | [环形链表](./linked-list-cycle/main.go) | 简单 | https://leetcode.cn/problems/linked-list-cycle/ | 已完成 |
15-
| 142 | [环形链表 II](./linked-list-cycle-ii/main.go) | 中等 | https://leetcode.cn/problems/linked-list-cycle-ii/ | 进行中 |
16-
| 189 | [轮转数组](./rotate-array/main.go) | 中等 | https://leetcode.cn/problems/rotate-array/ | 已完成 |
17-
| 206 | [反转链表](./reverse-linked-list/main.go) | 简单 | https://leetcode.cn/problems/reverse-linked-list/ | 已完成 |
18-
| 217 | [存在重复元素](./contains-duplicate/main.go) | 简单 | https://leetcode.cn/problems/contains-duplicate/ | 已完成 |
19-
| 234 | [回文链表](./palindrome-linked-list/main.go) | 简单 | https://leetcode.cn/problems/palindrome-linked-list/ | 已完成 |
20-
| 283 | [移动零](./move-zeroes/main.go) | 简单 | https://leetcode.cn/problems/move-zeroes/ | 已完成 |
21-
| 344 | [反转字符串](./reverse-string/main.go) | 简单 | https://leetcode.cn/problems/reverse-string/ | 已完成 |
22-
| 350 | [两个数组的交集 II](./intersection-of-two-arrays-ii/main.go) | 简单 | https://leetcode.cn/problems/intersection-of-two-arrays-ii/ | 已完成 |
23-
| 498 | [对角线遍历](./diagonal-traverse/main.go) | 中等 | https://leetcode.cn/problems/diagonal-traverse/ | 已完成 |
24-
| 622 | [设计循环队列](./diagonal-traverse/main.go) | 中等 | https://leetcode.cn/problems/design-circular-queue/ | 已完成 |
25-
| 707 | [设计链表](./design-linked-list/main.go) | 中等 | https://leetcode.cn/problems/design-linked-list/ | 已完成 |
26-
| 724 | [寻找数组的中心下标](./find-pivot-index/main.go) | 简单 | https://leetcode.cn/problems/find-pivot-index/ | 已完成 |
27-
| 747 | [至少是其他数字两倍的最大数](./largest-number-at-least-twice-of-others/main.go) | 简单 | https://leetcode.cn/problems/largest-number-at-least-twice-of-others/ | 已完成 |
6+
| [1.两数之和](./1.two-sum/main.go)| 简单 | https://leetcode.cn/problems/two-sum/ | 已完成 |
7+
| [9.回文数](./9.palindrome-number/main.go)| 简单 | https://leetcode.cn/problems/palindrome-number/ | 已完成 |
8+
| [21.合并两个有序链表](./21.merge-two-sorted-lists/main.go) | 简单 | https://leetcode.cn/problems/merge-two-sorted-lists/ | 已完成 |
9+
| [26.删除有序数组中的重复项](./26.remove-duplicates-from-sorted-array/main.go) | 简单 | https://leetcode.cn/problems/remove-duplicates-from-sorted-array/ | 已完成 |
10+
| [66.加一](./66.plus-one/main.go) | 简单 | https://leetcode.cn/problems/plus-one/ | 已完成 |
11+
| [83.删除排序链表中的重复元素](./83.remove-duplicates-from-sorted-list/main.go) | 简单 | https://leetcode.cn/problems/remove-duplicates-from-sorted-list/ | 已完成 |
12+
| [122.买卖股票的最佳时机 II](./122.best-time-to-buy-and-sell-stock-ii/main.go) | 中等 | https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/ | 已完成 |
13+
| [136.只出现一次的数字](./136.single-number/main.go) | 简单 | https://leetcode.cn/problems/single-number/ | 已完成 |
14+
| [141.环形链表](./141.linked-list-cycle/main.go) | 简单 | https://leetcode.cn/problems/linked-list-cycle/ | 已完成 |
15+
| [142.环形链表 II](./142.linked-list-cycle-ii/main.go) | 中等 | https://leetcode.cn/problems/linked-list-cycle-ii/ | 进行中 |
16+
| [189.轮转数组](./189.rotate-array/main.go) | 中等 | https://leetcode.cn/problems/rotate-array/ | 已完成 |
17+
| [206.反转链表](./206.reverse-linked-list/main.go) | 简单 | https://leetcode.cn/problems/reverse-linked-list/ | 已完成 |
18+
| [217.存在重复元素](./217.contains-duplicate/main.go) | 简单 | https://leetcode.cn/problems/contains-duplicate/ | 已完成 |
19+
| [234.回文链表](./234.palindrome-linked-list/main.go) | 简单 | https://leetcode.cn/problems/palindrome-linked-list/ | 已完成 |
20+
| [283.移动零](./283.move-zeroes/main.go) | 简单 | https://leetcode.cn/problems/move-zeroes/ | 已完成 |
21+
| [344.反转字符串](./344.reverse-string/main.go) | 简单 | https://leetcode.cn/problems/reverse-string/ | 已完成 |
22+
| [350.两个数组的交集 II](./350.intersection-of-two-arrays-ii/main.go) | 简单 | https://leetcode.cn/problems/intersection-of-two-arrays-ii/ | 已完成 |
23+
| [498.对角线遍历](./498.diagonal-traverse/main.go) | 中等 | https://leetcode.cn/problems/diagonal-traverse/ | 已完成 |
24+
| [622.设计循环队列](./622.design-circular-queue/main.go) | 中等 | https://leetcode.cn/problems/design-circular-queue/ | 已完成 |
25+
| [707.设计链表](./707.design-linked-list/main.go) | 中等 | https://leetcode.cn/problems/design-linked-list/ | 已完成 |
26+
| [724.寻找数组的中心下标](./724.find-pivot-index/main.go) | 简单 | https://leetcode.cn/problems/find-pivot-index/ | 已完成 |
27+
| [747.至少是其他数字两倍的最大数](./747.largest-number-at-least-twice-of-others/main.go) | 简单 | https://leetcode.cn/problems/largest-number-at-least-twice-of-others/ | 已完成 |
2828

2929

3030

0 commit comments

Comments
 (0)