You are viewing a single comment's thread. Return to all comments →
My clojure solutions.
(defn string-carousel [x] (let [rot-str (apply str (concat (rest x) (cons (first x) '())))] (lazy-seq (cons rot-str (string-carousel rot-str))))) (defn rotate-string [x] (->> (string-carousel x) (take (count x)))) (doseq [_ (range (Integer/parseInt (read-line)))] (println (clojure.string/join " " (rotate-string (read-line)))))
Any improvement ideas?
Rotate String
You are viewing a single comment's thread. Return to all comments →
My clojure solutions.
Any improvement ideas?