Go Solution using channels
I feel this is the cleanest solution. Simple inorder traversal and we loop(k-1) over the values being passed and then return the kth element.\n\ngo\nfunc walk(r
I feel this is the cleanest solution. Simple inorder traversal and we loop(k-1) over the values being passed and then return the kth element.\n\n```go\nfunc walk(root *TreeNode, c chan int) {\n\tif root == nil {\n\t\treturn\n\t}\n\n\twalk(root.Left, c)\n\tc <- root.Val\n\twalk(root.Right, c)\n}\n\nfunc kthSmallest(root *TreeNode, k int) int {\n\tc := make(chan int)\n\tgo walk(root, c)\n\n\tfor i := 0; i < k-1; i++ {\n\t\t<-c\n\t}\n\treturn <-c\n}\n```
['Go']