(defn palindrome? [items]
“Efficient algorithm: loops through only (array-size/2)”
(loop [i 0
j (-> items count dec)]
(cond (>= i j)
true
(not= (nth items i)
(nth items j))
false
:else
(recur (inc i) (dec j)))))
(let [test-cases-count (Integer/parseInt (read-line))
test-cases (dotimes [i test-cases-count]
(let [nums-count (read-line)
nums-temp (-> (read-line) (clojure.string/split #"\s+"))
nums (mapv #(Integer/parseInt %) nums-temp)]
(if (palindrome? nums)
(println "Yes")
(println "No"))
nums))])
I am solving this (https://www.codechef.com/problems/RAINBOWA) problem in clojure. My submission is failing due to TLE(time limit exceed 1.010000). Does code-chef only allows to solve problem in C and other lower-level languages. Any suggestions to improve code are welcome.