Skip to content

Commit c5b88c0

Browse files
author
Shuo
authored
Merge pull request #652 from openset/develop
Update: PackageName
2 parents 7d3b21e + c5ee633 commit c5b88c0

25 files changed

+26
-32
lines changed

internal/leetcode/question_data.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"regexp"
1010
"strconv"
1111
"strings"
12-
"unicode"
1312
)
1413

1514
func QuestionData(titleSlug string, isForce bool, graphQL ...string) (qd questionDataType) {
@@ -199,11 +198,7 @@ func (question *questionType) TitleSnake() string {
199198
}
200199

201200
func (question *questionType) PackageName() string {
202-
snake := question.TitleSnake()
203-
if snake != "" && unicode.IsNumber(rune(snake[0])) {
204-
snake = "p_" + snake
205-
}
206-
return snake
201+
return "problem_" + question.QuestionFrontendId
207202
}
208203

209204
func (question *questionType) SaveCodeSnippet() {

problems/01-matrix/01_matrix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_01_matrix
1+
package problem_542
22

33
func updateMatrix(matrix [][]int) [][]int {
44
m, n := len(matrix), len(matrix[0])

problems/01-matrix/01_matrix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_01_matrix
1+
package problem_542
22

33
import (
44
"reflect"

problems/1-bit-and-2-bit-characters/1_bit_and_2_bit_characters.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
package p_1_bit_and_2_bit_characters
1+
package problem_717
22

33
func isOneBitCharacter(bits []int) bool {
4-
l := len(bits) - 1
5-
i := 0
4+
i, l := 0, len(bits)-1
65
for i < l {
76
i += bits[i] + 1
87
}

problems/1-bit-and-2-bit-characters/1_bit_and_2_bit_characters_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_1_bit_and_2_bit_characters
1+
package problem_717
22

33
import "testing"
44

problems/132-pattern/132_pattern.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_132_pattern
1+
package problem_456
22

33
func find132pattern(nums []int) bool {
44
ak, ajStack := -1<<31, make([]int, 0, len(nums))

problems/132-pattern/132_pattern_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_132_pattern
1+
package problem_456
22

33
import "testing"
44

problems/2-keys-keyboard/2_keys_keyboard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_2_keys_keyboard
1+
package problem_650
22

33
func minSteps(n int) int {
44
if n == 1 {

problems/2-keys-keyboard/2_keys_keyboard_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_2_keys_keyboard
1+
package problem_650
22

33
import "testing"
44

problems/24-game/24_game.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_24_game
1+
package problem_679
22

33
import "sort"
44

problems/24-game/24_game_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_24_game
1+
package problem_679
22

33
import "testing"
44

problems/3sum-closest/3sum_closest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_3sum_closest
1+
package problem_16
22

33
import (
44
"math"

problems/3sum-closest/3sum_closest_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_3sum_closest
1+
package problem_16
22

33
import "testing"
44

problems/3sum-smaller/3sum_smaller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package p_3sum_smaller
1+
package problem_258
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package p_3sum_smaller
1+
package problem_258
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package p_3sum_with_multiplicity
1+
package problem_923
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package p_3sum_with_multiplicity
1+
package problem_923

problems/3sum/3sum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_3sum
1+
package problem_15
22

33
import "sort"
44

problems/3sum/3sum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_3sum
1+
package problem_15
22

33
import (
44
"reflect"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package p_4_keys_keyboard
1+
package problem_651
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package p_4_keys_keyboard
1+
package problem_651

problems/4sum-ii/4sum_ii.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_4sum_ii
1+
package problem_454
22

33
func fourSumCount(A []int, B []int, C []int, D []int) int {
44
ans, n := 0, len(A)

problems/4sum-ii/4sum_ii_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_4sum_ii
1+
package problem_454
22

33
import "testing"
44

problems/4sum/4sum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_4sum
1+
package problem_18
22

33
import "sort"
44

problems/4sum/4sum_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package p_4sum
1+
package problem_18
22

33
import (
44
"reflect"

0 commit comments

Comments
 (0)