Clojure & algorithm platforms

Clojure & algorithm platforms

Β·

1 min read

Have you ever heard about LeetCode, TopCoder, HackerRank and similar platforms?

I have bad news - the most popular ones do not support Clojure πŸ˜•

Hopefully I have found 2 that do:

πŸ‘Ž CodeChef - I tried to solve some hello world problem and got TLE, people had similar experiences (link) -> I cannot recommend this platform.

πŸ‘ SPOJ - it worked for me with test problem like this one.

Below is solution if you are interested.

(defn read-int
  []
  (let [l (read-line)]
    (Integer/parseInt l)))

(defn main
  []
  (let [n (read-int)]
    (when (not (= n 42))
      (println n)
      (recur))))

(main)
Β