leetcode-go/src/node.go

16 lines
208 B
Go
Raw Normal View History

2022-05-22 15:54:36 +00:00
package src
import "fmt"
2022-05-23 08:43:38 +00:00
type ListNode struct {
Val int
Next *ListNode
2022-05-22 15:54:36 +00:00
}
2022-05-23 08:43:38 +00:00
func (n *ListNode) String() string {
2022-05-22 15:54:36 +00:00
if n == nil {
return "nil"
}
2022-05-23 08:43:38 +00:00
return fmt.Sprintf("{Val:%d Next:%+v}", n.Val, *n.Next)
2022-05-22 15:54:36 +00:00
}