Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions internal/leetcode/question_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (question *questionType) getDescContent() []byte {
question.Title,
question.Difficulty.Str(),
question.LeetCodeURL(),
question.TranslatedTitle,
question.translatedTitle(),
))
cts := filterContents(question.Content)
// remove style
Expand All @@ -134,21 +134,32 @@ func (question *questionType) getDescContent() []byte {
return buf.Bytes()
}

func (question *questionType) questionID() int {
id, _ := strconv.Atoi(question.QuestionID)
return id
}

func (question *questionType) translatedTitle() string {
if question.TranslatedTitle == "" {
question.TranslatedTitle = translationSet[question.questionID()]
}
return question.TranslatedTitle
}

func (question *questionType) getNavigation() string {
nav, pre, next := "\n%s\n%s\n%s\n", "< Previous", "Next >"
problems := ProblemsAll().StatStatusPairs
if id, err := strconv.Atoi(question.QuestionID); err == nil {
format := `[%s](https://github.com/openset/leetcode/tree/master/problems/%s "%s")`
for i, problem := range problems {
if problem.Stat.QuestionID == id {
if i < len(problems)-1 {
pre = fmt.Sprintf(format, pre, problems[i+1].Stat.QuestionTitleSlug, problems[i+1].Stat.QuestionTitle)
}
if i > 0 {
next = fmt.Sprintf(format, next, problems[i-1].Stat.QuestionTitleSlug, problems[i-1].Stat.QuestionTitle)
}
break
id := question.questionID()
format := `[%s](https://github.com/openset/leetcode/tree/master/problems/%s "%s")`
for i, problem := range problems {
if problem.Stat.QuestionID == id {
if i < len(problems)-1 {
pre = fmt.Sprintf(format, pre, problems[i+1].Stat.QuestionTitleSlug, problems[i+1].Stat.QuestionTitle)
}
if i > 0 {
next = fmt.Sprintf(format, next, problems[i-1].Stat.QuestionTitleSlug, problems[i-1].Stat.QuestionTitle)
}
break
}
}
return fmt.Sprintf(nav, pre, strings.Repeat(" ", 16), next)
Expand Down
2 changes: 1 addition & 1 deletion problems/closest-binary-search-tree-value/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@


### Related Topics
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]
[[Binary Search](https://github.com/openset/leetcode/tree/master/tag/binary-search/README.md)]
[[Tree](https://github.com/openset/leetcode/tree/master/tag/tree/README.md)]

### Similar Questions
1. [Count Complete Tree Nodes](https://github.com/openset/leetcode/tree/master/problems/count-complete-tree-nodes) (Medium)
Expand Down
5 changes: 0 additions & 5 deletions problems/design-skiplist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,3 @@ skiplist.search(1); // return false, 1 has already been erased.</pre>

### Related Topics
[[Design](https://github.com/openset/leetcode/tree/master/tag/design/README.md)]

### Similar Questions
1. [Design HashSet](https://github.com/openset/leetcode/tree/master/problems/design-hashset) (Easy)
1. [Design HashMap](https://github.com/openset/leetcode/tree/master/problems/design-hashmap) (Easy)
1. [Design Linked List](https://github.com/openset/leetcode/tree/master/problems/design-linked-list) (Easy)
5 changes: 1 addition & 4 deletions problems/highest-grade-for-each-student/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

[Next >](https://github.com/openset/leetcode/tree/master/problems/reported-posts "Reported Posts")

## [1112. Highest Grade For Each Student (Medium)](https://leetcode.com/problems/highest-grade-for-each-student "")
## [1112. Highest Grade For Each Student (Medium)](https://leetcode.com/problems/highest-grade-for-each-student "每位学生的最高成绩")



### Similar Questions
1. [Department Highest Salary](https://github.com/openset/leetcode/tree/master/problems/department-highest-salary) (Medium)