Ad
  • Custom User Avatar

    Some googling suggests that when you concatenate or take a substring of a Java string, it makes a copy. This takes O(n) time, like iterating over all the characters. Maybe you could avoid this by casting to a char array and then mutating it, but that is not idiomatic to Clojure.

  • Custom User Avatar

    O(n^2) because the for comprehension generates a cartesian product of the numbers vector with itself (or more specifically in this case, the indices of the numbers vector)