Skip to content

Commit 10a222e

Browse files
author
Shuo
authored
Merge pull request #722 from openset/develop
v1.5.1
2 parents 80a8eaf + 3192b1f commit 10a222e

File tree

4 files changed

+35
-15
lines changed

4 files changed

+35
-15
lines changed

internal/question/question.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,22 @@ func runQuestion(cmd *base.Command, args []string) {
2222
cmd.Usage()
2323
return
2424
}
25-
if id, err := strconv.Atoi(args[0]); err == nil {
26-
problems := leetcode.ProblemsAll()
27-
for _, problem := range problems.StatStatusPairs {
28-
if problem.Stat.FrontendQuestionID == id {
29-
fmt.Println(id, "\t"+problem.Stat.QuestionTitle)
30-
titleSlug := problem.Stat.QuestionTitleSlug
31-
question := leetcode.QuestionData(titleSlug, true).Data.Question
32-
if question.Content == "" && problem.PaidOnly == true && problem.Stat.QuestionArticleLive {
33-
question.Content = leetcode.GetDescription(problem.Stat.QuestionArticleSlug)
34-
}
35-
question.SaveContent()
36-
question.SaveCodeSnippet()
37-
return
25+
id, err := strconv.Atoi(args[0])
26+
if err != nil {
27+
return
28+
}
29+
problems := leetcode.ProblemsAll()
30+
for _, problem := range problems.StatStatusPairs {
31+
if problem.Stat.FrontendQuestionID == id {
32+
fmt.Println(id, "\t"+problem.Stat.QuestionTitle)
33+
titleSlug := problem.Stat.QuestionTitleSlug
34+
question := leetcode.QuestionData(titleSlug, true).Data.Question
35+
if question.Content == "" && problem.PaidOnly == true && problem.Stat.QuestionArticleLive {
36+
question.Content = leetcode.GetDescription(problem.Stat.QuestionArticleSlug)
3837
}
38+
question.SaveContent()
39+
question.SaveCodeSnippet()
40+
return
3941
}
4042
}
4143
}

internal/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/openset/leetcode/internal/base"
99
)
1010

11-
const version = "1.5.0"
11+
const version = "1.5.1"
1212

1313
// CmdVersion - version.CmdVersion
1414
var CmdVersion = &base.Command{

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func main() {
4949
return
5050
}
5151
args := flag.Args()
52-
cmdName := args[0]
52+
cmdName := flag.Arg(0)
5353
for _, cmd := range base.Commands {
5454
if cmd.Name() == cmdName {
5555
cmd.Run(cmd, args[1:])

problems/insert-into-a-sorted-circular-linked-list/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,25 @@
1111

1212
## [708. Insert into a Sorted Circular Linked List (Medium)](https://leetcode.com/problems/insert-into-a-sorted-circular-linked-list "循环有序列表的插入")
1313

14+
<p>Given a node from a cyclic linked list which is sorted in ascending order, write a function to insert a value into the list such that it remains a cyclic sorted list. The given node can be a reference to <em>any</em> single node in the list, and may not be necessarily the smallest value in the cyclic list.</p>
1415

16+
<p>If there are multiple suitable places for insertion, you may choose any place to insert the new value. After the insertion, the cyclic list should remain sorted.</p>
17+
18+
<p>If the list is empty (i.e., given node is <code>null</code>), you should create a new single cyclic list and return the reference to that single node. Otherwise, you should return the original given node.</p>
19+
20+
<p>The following example may help you understand the problem better:</p>
21+
22+
<p>&nbsp;</p>
23+
24+
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/01/19/example_1_before_65p.jpg" style="width: 250px; height: 149px;" /><br />
25+
<br />
26+
<small>In the figure above, there is a cyclic sorted list of three elements. You are given a reference to the node with value 3, and we need to insert 2 into the list.</small></p>
27+
28+
<p>&nbsp;</p>
29+
30+
<p><img alt="" src="https://assets.leetcode.com/uploads/2019/01/19/example_1_after_65p.jpg" style="width: 250px; height: 149px;" /><br />
31+
<br />
32+
<small>The new node should insert between node 1 and node 3. After the insertion, the list should look like this, and we should still return node 3.</small></p>
1533

1634
### Related Topics
1735
[[Linked List](https://github.com/openset/leetcode/tree/master/tag/linked-list/README.md)]

0 commit comments

Comments
 (0)