We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is my solution of the Dominoes challenge.
(ns dominoes) (defn vec-remove [pos coll] (into (subvec coll 0 pos) (subvec coll (inc pos)))) (defn can-complete-chain? [stones rem-stones] (cond (and (= 0 (count rem-stones)) (= (first (first stones)) (last (last stones)))) true (= 0 (count rem-stones)) false :else (let [last-stone (last stones) necessary-value (last last-stone) possible-stones (filter (fn [item] (or (= necessary-value (get item 0)) (= necessary-value (get item 1)))) rem-stones) can-complete-chain-arr (map (fn [item] (let [index-of (.indexOf rem-stones item) updated-rem-stones (vec-remove index-of rem-stones) right-pos-stone (if (= necessary-value (get item 0)) item (reverse item)) updated-stones (concat stones [right-pos-stone]) ] (can-complete-chain? updated-stones updated-rem-stones) ) ) possible-stones) ] (some true? can-complete-chain-arr) ) ) ) (defn can-chain? ([stones] (if (= (count stones) 0) true (can-chain? stones 0) ) ) ([stones index] (let [stone (get stones index) inverted-stone (reverse stone) rem-stones (vec-remove index stones) stone-can-be-start-of-chain (can-complete-chain? [stone] rem-stones) inverted-stone-can-be-start-of-chain (can-complete-chain? [inverted-stone] rem-stones) ] (cond (or stone-can-be-start-of-chain inverted-stone-can-be-start-of-chain) true (<= (inc index) (dec (count stones))) (recur stones (inc index)) :else false) ) ))
The problem is that in my local machine all tests work fine but on the platform the tests seem to fail. Can someone help me?
The text was updated successfully, but these errors were encountered:
It's the .indexOf method, which isn't available because the online test runner is powered by SCI.
.indexOf
We apologize for the confusion because there's no way you would have known that. We're still working out how we can make this more clear.
Sorry, something went wrong.
It's the .indexOf method, which isn't available because the online test runner is powered by SCI. We apologize for the confusion because there's no way you would have known that. We're still working out how we can make this more clear.
Thanks for answering! I had to implement a index-of function manually and after that it worked fine!
No branches or pull requests
Here is my solution of the Dominoes challenge.
The problem is that in my local machine all tests work fine but on the platform the tests seem to fail.
Can someone help me?
The text was updated successfully, but these errors were encountered: