Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitecf250d

Browse files
committed
update sitemap lib
1 parent317fa4f commitecf250d

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

‎cmd/sitemap/sitemap.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Config struct {
1010
}
1111

1212
typeSiteMapstruct {
13-
Url []UrlSet
13+
UrlSet []UrlSet`xml:"urlset"`
1414
}
1515

1616
funcNew(problems []leetcode.Problem)SiteMap {
@@ -22,6 +22,10 @@ func New(problems []leetcode.Problem) SiteMap {
2222
}
2323

2424
typeUrlSetstruct {
25-
Locstring
26-
Lastmodstring
25+
Url []Url`xml:"url"`
26+
}
27+
28+
typeUrlstruct {
29+
Locstring`xml:"loc"`
30+
Lastmodstring`xml:"lastmod"`
2731
}

‎cmd/util/file.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package util
2+
3+
import (
4+
"fmt"
5+
"os"
6+
)
7+
8+
funcWriteFile(path,sstring) {
9+
f,err:=os.Create("sitemap.xml")
10+
iferr!=nil {
11+
fmt.Println(err.Error())
12+
}
13+
deferf.Close()
14+
15+
f.WriteString(s)
16+
17+
}

‎src/0300.Longest-Increasing-Subsequence/Solution.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ import (
44
"sort"
55
)
66

7+
//dp[i] = dp[i-1] + 1
8+
79
funclengthOfLIS(nums []int)int {
810
iflen(nums)==0 {
911
return0
1012
}
1113
dp,ans:=make([]int,len(nums)),1
1214

15+
//子序列最少要包含自己
1316
fori:=0;i<len(nums);i++ {
1417
dp[i]=1
1518
}
@@ -19,11 +22,8 @@ func lengthOfLIS(nums []int) int {
1922
ifnums[i]>nums[j] {
2023
dp[i]=max(dp[i],dp[j]+1)
2124
}
22-
//fmt.Println(i, j, ans, dp, nums)
23-
}
24-
ifdp[i]>ans {
25-
ans=dp[i]
2625
}
26+
ans=max(dp[i],ans)
2727
}
2828
returnans
2929
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp