Skip to content

Commit

Permalink
satellite: fix parameter order (#1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom authored Jan 15, 2025
1 parent 6ba9a1c commit 5b3dd60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions exercises/practice/satellite/.meta/Example.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ let rec createTree inorder preorder =
let leftPreorder, rightPreorder = tail[0 .. leftInorder.Length - 1], tail[leftInorder.Length ..]
Node(hd, createTree leftInorder leftPreorder, createTree rightInorder rightPreorder)

let treeFromTraversals preorder inorder =
let treeFromTraversals inorder preorder =
if List.length preorder <> List.length inorder then
Error "traversals must have the same length"
elif List.sort preorder <> List.sort inorder then
Error "traversals must have the same elements"
elif List.distinct preorder <> preorder then
Error "traversals must contain unique items"
else
Ok(createTree preorder inorder)
Ok(createTree inorder preorder)
2 changes: 1 addition & 1 deletion exercises/practice/satellite/Satellite.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ type Tree =
| Empty
| Node of value: string * left: Tree * right: Tree

let treeFromTraversals preorder inorder =
let treeFromTraversals inorder preorder =
failwith "Please implement the 'treeFromTraversals' function"

0 comments on commit 5b3dd60

Please sign in to comment.