(root *TreeNode)
| 3 | import . "github.com/austingebauer/go-leetcode/structures" |
| 4 | |
| 5 | func isValidBST(root *TreeNode) bool { |
| 6 | if root == nil || (root.Left == nil && root.Right == nil) { |
| 7 | return true |
| 8 | } |
| 9 | |
| 10 | in := inorderTraversal(root) |
| 11 | for i := 1; i < len(in); i++ { |
| 12 | if in[i-1] >= in[i] { |
| 13 | return false |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | return true |
| 18 | } |
| 19 | |
| 20 | func inorderTraversal(root *TreeNode) []int { |
| 21 | if root == nil { |