請檢查我的代碼。我找不到錯誤在哪裏。問題是here。 這裏是我的解決方案: # Given a binary tree, find all paths that sum of the nodes in the path equals to a given number target.
#
# A valid path is from root node to any of the leaf n
我的樹具有以下數據類型。 data Tree a = Leaf a | Node (Tree a) a (Tree a) deriving (Show)
我想打印使用左到右的深度優先遍歷給定樹的表示。 目前,我決定採用模式匹配。 showt :: Tree a -> [Char]
showt (Leaf a) = [a]
...
當我嘗試使用GHCI運行它,這裏的錯誤,我得到 • Co
我想在一棵二叉樹中得到一個父親的所有下行線,每個父親有左右手臂,每個手臂有左右手臂等等。 like the following image。 在我的數據庫中,我有一張名爲users的表,每個用戶都有一個父親id和位置是L或R. 這是我的功能..但它仍然沒有得到所有下線。 like the following image。