We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hmm, that seems to be the algorithm I am using.
Can you spot an error in this snippet:
;;;; points includes the first tuple as last element;;;; to make sure that connection is included as well(defn polygon-area-parts[points](let [n(count points)](loop [pos0deltas[]](if (= pos(- n1))deltas(let [[x_iy_i](nth pointspos)[x_jy_j](nth points(inc pos))entry(- (* x_iy_j)(* x_jy_i))](recur(inc pos)(conj deltasentry)))))))(defn polygon-area[points](->>(polygon-area-partspoints)(reduce + 0)(#(Math/abs%1))(#(/ %12))))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Compute the Area of a Polygon
You are viewing a single comment's thread. Return to all comments →
Hmm, that seems to be the algorithm I am using. Can you spot an error in this snippet: