Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions rust/subjects/01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ assert_eq!(big_add(b"0010", b"0200"), b"210");

```rust
// allowed symbols
use slice::*;
use std::{
vec::Vec::*,
iter::*,
Expand All @@ -336,13 +337,13 @@ pub struct Task {
For a task `i`:
* `tasks[i].start_time` is the start time for `task[i]`
* `tasks[i].end_time` is the end time for `task[i]`
* `tasks[i].cookies` is how many cookies he will get from students for finishing `task[i]`
* `tasks[i].cookies` is how many cookies he will get for finishing `task[i]`

Unfortunately, he sucks at multitasking. Write a **function** which returns the maximum amount of cookies he can get without any tasks overlapping.
Your function must have this signature:

```rust
pub fn time_manager(tasks: &mut Vec<Task>) -> u32
pub fn time_manager(tasks: &mut [Task]) -> u32
```

**Constraints**
Expand Down
10 changes: 7 additions & 3 deletions rust/tester/src/module01/exercise07/shortinette_tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#[cfg(test)]
mod shortinette_tests_rust_0107 {
use ex07::time_manager;
use ex07::Task;
use rand::seq::SliceRandom;
use ex07::time_manager;
use rand::Rng;
use rand::seq::SliceRandom;
use std::fmt::{Display, Error, Formatter};

struct Testcase {
Expand All @@ -25,7 +25,11 @@ mod shortinette_tests_rust_0107 {
)
})
.collect();
write!(f, "{:?}", strings)
write!(
f,
"{:?} (formatted as Task {{ start_time, end_time, cookies }})",
strings
)
}
}

Expand Down
Loading