Skip to content

Commit

Permalink
Update instructions append for anagram
Browse files Browse the repository at this point in the history
- Remove some performance considerations.
  These are basically giving away the implementation.
  Also, not every student might want to focus on performance.
  Such considerations may be better suited for approaches articles.

- Remove non-Rust-related hints.
  These are pretty much covered by the instructions.
  I guess these were lacking at some point, but updated in the meantime.

- Move the most important hint about lifetimes to the top.
  • Loading branch information
senekor committed Jan 4, 2024
1 parent 39163d0 commit 084cebf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions exercises/practice/anagram/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Hints

The solution is case insensitive, which means `"WOrd"` is the same as `"word"` or `"woRd"`. It may help to take a peek at the [std library](https://doc.rust-lang.org/std/primitive.char.html) for functions that can convert between them.
You are going to have to adjust the function signature provided in the stub in order for the lifetimes to work out properly.
This is intentional: what's there demonstrates the basics of lifetime syntax, and what's missing teaches how to interpret lifetime-related compiler errors.

The solution cannot contain the input word. A word is always an anagram of itself, which means it is not an interesting result. Given `"hello"` and the list `["hello", "olleh"]` the answer is `["olleh"]`.

You are going to have to adjust the function signature provided in the stub in order for the lifetimes to work out properly. This is intentional: what's there demonstrates the basics of lifetime syntax, and what's missing teaches how to interpret lifetime-related compiler errors.

Try to limit case changes. Case changes are expensive in terms of time, so it's faster to minimize them.

If sorting, consider [sort_unstable](https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable) which is typically faster than stable sorting. When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn't allocate auxiliary memory.
The solution is case insensitive, which means `"WOrd"` is the same as `"word"` or `"woRd"`.
It may help to take a peek at the [std library](https://doc.rust-lang.org/std/primitive.char.html) for functions that can convert between them.

0 comments on commit 084cebf

Please sign in to comment.