- 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
(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))))) |