Skip to content

Commit 518a07e

Browse files
hongda3141default name
and
default name
authored
add more introduction details for magazine-cutout (#1440)
* add more details for magazine-cutout * add adjustmented details for magazine-cutout Co-authored-by: default name <[email protected]>
1 parent f9d75ac commit 518a07e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

exercises/concept/magazine-cutout/.docs/instructions.md

+12
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@ assert!(!can_construct_note(&magazine, &note));
2626
```
2727

2828
The function returns `false` since the magazine only contains one instance of `"two"` when the note requires two of them.
29+
30+
The following input will succeed:
31+
32+
```rust
33+
let magazine = "Astronomer Amy Mainzer spent hours chatting with Leonardo DiCaprio for Netflix's 'Don't Look Up'".split_whitespace().collect::<Vec<&str>>();
34+
let note = "Amy Mainzer chatting with Leonardo DiCaprio."
35+
.split_whitespace()
36+
.collect::<Vec<&str>>();
37+
assert!(can_construct_note(&magazine, &note));
38+
```
39+
40+
The function returns `true` since the magazine contains all the words that the note requires.

exercises/concept/magazine-cutout/tests/magazine-cutout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use magazine_cutout::*;
22

33
#[test]
4-
fn test_example_works() {
4+
fn test_magazine_has_fewer_words_available_than_needed() {
55
let magazine = "two times three is not four"
66
.split_whitespace()
77
.collect::<Vec<&str>>();

0 commit comments

Comments
 (0)