I'm just getting started on the site CodeEval, and I submitted my first solution today. What I don't understand is why it's marking my (working) answer as only a "partial solution". The site doesn't seem to want to explain why my answer is only "partial", and I'm hoping someone here can explain why.
The challenge I was trying to do was FizzBuzz, where you take in three numbers as input and output a sequence of increasing numbers, substituting "F" for a number if it's divisible by the first input number, "B" for a number if it's divisible by the second input number, and "FB" if it's divisible by both.
Here's my solution:
(defn process-line [[x y n]]
(for [i (range 1 (inc n))]
(cond
(and (zero? (mod i x)) (zero? (mod i y))) "FB"
(zero? (mod i x)) "F"
(zero? (mod i y)) "B"
:else (str i))))
(defn string->int [string]
(let [elements (clojure.string/split string #" ")]
(into [] (map read-string elements))))
; Sample code to read in test cases:
; Open the file passed as the first command line argument
(with-open [rdr (clojure.java.io/reader (first *command-line-args*))]
; Read each line ignoring empty ones
(doseq [line (remove empty? (line-seq rdr))]
(let [out-line (process-line (string->int line))]
(println (clojure.string/join " " out-line)))))
The only thing I can think of is the following: when it shows the memory usage of my working solution (it currently uses 71098368 bytes) there's a little tooltip that says "Reduce memory usage to 20Mb". Is that the cause of the "partial" in my solution, and, if so, how could I reduce my memory usage? My solution already seems pretty simple.
solved
. However when the memory was calculated, it changed intopartially
. \$\endgroup\$ – TheCoffeeCup Oct 24 '15 at 22:17