Note: This solution is O(n) because (apply * list) expands into (* list0 list1 ... listn)
(defnrest-vec[lst]"`rest` that returns a vector instead of a list"(into[](restlst)))(defnarray-of-products[arr]"Calculates product of everything but the first
element and then moves the first element to the end and loops"(loop[lstarrtime0res[]](if(>=time(countlst))res(recur(conj(rest-veclst)(firstlst))(inctime)(conjres(apply*(restlst)))))))(array-of-products[8102]);; [20 16 80](array-of-products[2743]);; [84 24 42 56]
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Clojure solution
Note: This solution is O(n) because
(apply * list)
expands into(* list0 list1 ... listn)