This commit is contained in:
TheOldestBrother 2024-09-06 10:08:53 +01:00 committed by GitHub
commit 32b3a80b24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 2 deletions

View File

@ -14,7 +14,10 @@ You will implement some **CRUD** functionality for a game session. You will need
- `delete`: which takes ownership of the boxed game session and returns a string: `"game deleted: id -> 0"`, where `0` is the id of the `GameSession`.
> If `nb_games` is 5, then it is "best out of 5", and no more than 5 games can be played. If some player has a score of 3, then the game session is also finished. This is because there is an insufficient number of remaining games for the trailing player to catch up.
> Examples for `nb_games`:
>
> `nb_games` = **5** --> the maximum of games will be **5** and if some player has a score of 3, the game is finished (not enough games for the other player to win).\
> `nb_games` = **11** --> the maximum of games will be **11** and if some player has a score of 6, the game is finished (not enough games for the other player to win).
### Expected Functions

View File

@ -6,6 +6,9 @@ Create a **function** which returns the first prime number which is greater than
The function must be optimized, so as to avoid time-outs.
> [!TIP]
> As a reminder, a `prime number` is a whole number greater than 1 that cannot be exactly divided by any whole number other than itself and 1.
> We consider that only positive numbers can be prime numbers.
### Expected function

View File

@ -6,6 +6,11 @@ Create a **function** which returns the first prime number which is less than or
If there are no smaller primes, the function should return `0`.
> [!TIP]
> As a reminder, a `prime number` is a whole number greater than 1 that cannot be exactly divided by any whole number other than itself and 1.
> We consider that only positive numbers can be prime numbers.
### Expected function
```rust

View File

@ -8,6 +8,11 @@ The result will be `None` if the argument is less or equal one, otherwise it wil
If the `u32` is prime, the function will return an`Ok(u32)`. For any other case it will return an `enum` `PrimeErr`.
The `enum` `PrimeErr` will be `Even` if the number is a multiple of two or `Divider(u32)` where the `u32` is the smallest divider of the number.
> [!TIP]
> As a reminder, a `prime number` is a whole number greater than 1 that cannot be exactly divided by any whole number other than itself and 1.
> We consider that only positive numbers can be prime numbers.
> Your solution should be optimized to a certain degree.
### Expected Function and structure

View File

@ -4,7 +4,7 @@
Lets play a little.
Create a function named `score` that given a string, computes the score for that given string as a `u64`.
Create a function named `score` that given a `&str`, computes the score for that given string as a `u64`.
Each letter has a value, you just have to sum the values of the letters in the given string.
@ -21,6 +21,7 @@ You will need these:
| Q, Z | 10 |
### Expected functions
> You'll need to work out the function signature for yourself.
### Usage