Skip to content

Commit

Permalink
Update exercises/practice/reverse-string/.approaches/recursion/conten…
Browse files Browse the repository at this point in the history
…t.md

Co-authored-by: Anastasios Chatzialexiou <16361161+tasxatzial@users.noreply.github.com>
  • Loading branch information
michalporeba and tasxatzial authored Jan 22, 2024
1 parent bf79270 commit fe22b2e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## Performance considerations

It is not necessarily bad to use recursion as in these two examples.
It is not necessarily bad to use recursion as shown in the example above.
In fact, many other approaches use recursion behind the scenes as, for instance, `clojure.string/join` is implemented using recursion.
However, we should remember that strings are immutable, so code like the above will be inefficient.
Instead, we should consider using the `StringBuilder` in the recursive function. For example, like so:
Expand Down

0 comments on commit fe22b2e

Please sign in to comment.