Skip to content

Instantly share code, notes, and snippets.

@derrickturk
Created July 11, 2022 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derrickturk/660795c463b4583e804dfda86a802a40 to your computer and use it in GitHub Desktop.
Save derrickturk/660795c463b4583e804dfda86a802a40 to your computer and use it in GitHub Desktop.
Stunting on Dumb Twitter Coding Interview guy, in Prolog
tree(nil).
tree([_, Left, Right]) :- tree(Left), tree(Right).
revtree(nil, nil).
revtree([Data, RLeft, RRight], [Data, Left, Right]) :-
revtree(RLeft, Right),
revtree(RRight, Left).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment