You are viewing a single comment's thread. Return to all comments →
One of the possible way to do it Golang
func utopianTree(n int32) int32 { if n == 0 { return 1 } if n == 1 { return 2 } var h, i int32 = 1, 1 for i <= n { h = h * 2 i++ if i <= n { h = h + 1 i++ } } return h }
Seems like cookies are disabled on this browser, please enable them to open this website
Utopian Tree
You are viewing a single comment's thread. Return to all comments →
One of the possible way to do it Golang