Skip to content

Instantly share code, notes, and snippets.

@zajac
Last active April 20, 2017 12:18
Show Gist options
  • Save zajac/ab63053e61ca54d7a2e82fa68affb186 to your computer and use it in GitHub Desktop.
Save zajac/ab63053e61ca54d7a2e82fa68affb186 to your computer and use it in GitHub Desktop.
(defn longest [xs ys] (if (> (count xs) (count ys)) xs ys))
(defn xxx [[x & xs] [y & ys]]
(cond
(or (nil? x) (nil? y)) nil
(= x y) (cons x (xxx xs ys))
:else (longest (xxx (cons x xs) ys) (xxx xs (cons y ys)))))
  • What does function xxx is supposed to calculate?
  • What is it's time complexity?
  • How would you optimize it?

Please email me directly with the answers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment