Pete and Billy are great fans of even numbers, that's why they want to divide the number of watermelons in such a way that each of the two parts consists of an even number of watermelons. However, it is not obligatory that the parts are equal.
Example: the boys can divide a stack of 8 watermelons into 2+6 melons, or 4+4 melons.
切西瓜,只能切成偶數加偶數,若給予的數字不能分為偶數加偶數,則回傳 false
(ns kata)
(defn divide [n]
(cond
(= n 2) false
(= 0 (rem n 2)) true
:else false)
)
翻譯 DNA
(ns complementary-dna)
(defn dna-strand [dna]
(clojure.string/replace dna #"A|T|C|G" {"A" "T" "T" "A" "C" "G" "G" "C"})
)
(ns complementary-dna)
(defn dna-strand [dna]
(apply str (map {\A \T \C \G \G \C \T \A} dna)))