-
-
Notifications
You must be signed in to change notification settings - Fork 557
Rework sum-of-multiples documentation #2249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d98ef27
Rework sum-of-multiples documentation
kytrinyx c217225
Simplify worked sum-of-multiples example
kytrinyx 3ff7bbd
Update exercises/sum-of-multiples/instructions.md
kytrinyx 8b6e789
Update exercises/sum-of-multiples/instructions.md
kytrinyx a6e07a0
Update exercises/sum-of-multiples/instructions.md
kytrinyx 7743045
Update exercises/sum-of-multiples/introduction.md
kytrinyx fd627c1
Update exercises/sum-of-multiples/instructions.md
kytrinyx 846a368
Update exercises/sum-of-multiples/instructions.md
kytrinyx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Instructions | ||
|
|
||
| Your task is to write the code that calculates the energy points that get awarded to players when they complete a level. | ||
|
|
||
| The points awarded depend on two things: | ||
|
|
||
| - The level (a number) that the player completed. | ||
| - The base value of each magical item collected by the player during that level. | ||
|
|
||
| The energy points are awarded according to the following rules: | ||
|
|
||
| 1. For each magical item, take the base value and find all the multiples of that value that are less than or equal to the level number. | ||
| 2. Combine the sets of numbers. | ||
| 3. Remove any duplicates. | ||
| 4. Calculate the sum of all the numbers that are left. | ||
|
|
||
| Let's look an example: | ||
|
|
||
| **The player completed level 20 and found two magical items with base values of 3 and 5.** | ||
|
|
||
| To calculate the energy points earned by the player, we need to find all the unique multiples of these base values that are less than or equal to level 20. | ||
|
|
||
| - Multiples of 3 up to 20: `{3, 6, 9, 12, 15, 18}` | ||
| - Multiples of 5 up to 20: `{5, 10, 15, 20}` | ||
| - Combine the sets and remove duplicates: `{3, 5, 6, 9, 10, 12, 15, 18, 20}` | ||
| - Sum the unique multiples: `3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20 = 98` | ||
| - Therefore, the player earns **98** energy points for completing level 20 and finding the two magical items with base values of 3 and 5. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Introduction | ||
|
|
||
| You work for a company that makes an online, fantasy-survival game. | ||
|
|
||
| When a player finishes a level, they are awarded energy points. | ||
| The amount of energy awarded depends on which magical items the player found while exploring that level. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kytrinyx We changed the problem definition in the markdown and it no longer matches the tests.
@vaeng is going to open a PR to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2261