Skip to content

Commit

Permalink
rename export funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
qinyuhang committed Jul 26, 2024
1 parent 685593a commit 8082192
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 5 additions & 1 deletion solutions/2sum.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package solutions

func TwoSum(nums []int, target int) []int {
func twoSum(nums []int, target int) []int {
m := make(map[int]int)

for i := 0; i < len(nums); i++ {
@@ -12,3 +12,7 @@ func TwoSum(nums []int, target int) []int {
}
return nil
}

func TwoSum(nums []int, target int) []int {
return twoSum(nums, target)
}
8 changes: 6 additions & 2 deletions solutions/sameTree.go
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import "go_lc/dataStruct"

type TreeNode = dataStruct.TreeNode

func IsSameTree(p *TreeNode, q *TreeNode) bool {
func isSameTree(p *TreeNode, q *TreeNode) bool {
if p == nil && q == nil {
return true
}
@@ -14,5 +14,9 @@ func IsSameTree(p *TreeNode, q *TreeNode) bool {
if p.Val != q.Val {
return false
}
return IsSameTree(p.Left, q.Left) && IsSameTree(p.Right, q.Right)
return isSameTree(p.Left, q.Left) && isSameTree(p.Right, q.Right)
}

func IsSameTree(p *TreeNode, q *TreeNode) bool {
return isSameTree(p, q)
}
6 changes: 5 additions & 1 deletion solutions/symmetricTree.go
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ func isMirror(left, right *TreeNode) bool {
}
return left.Val == right.Val && isMirror(left.Left, right.Right) && isMirror(left.Right, right.Left)
}
func IsSymmetric(root *TreeNode) bool {
func isSymmetric(root *TreeNode) bool {
if root == nil {
return true
}
@@ -21,3 +21,7 @@ func IsSymmetric(root *TreeNode) bool {
}
return isMirror(root.Left, root.Right)
}

func IsSymmetric(root *TreeNode) bool {
return isSymmetric(root)
}

0 comments on commit 8082192

Please sign in to comment.