-
-
Notifications
You must be signed in to change notification settings - Fork 557
Update square-root description.md #2495
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 13 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
15af7bf
Update description.md
xanni 0ec6899
Update description.md
xanni d4f9c27
Update description.md
xanni 46670c7
Update description.md
xanni 7807e7a
One line per sentence and don't use the word "function"
xanni 34af70c
Split description into introduction and instructions
xanni 1ae54c6
Update exercises/square-root/introduction.md
xanni f2f6a2c
Update exercises/square-root/instructions.md
xanni dcfe0d6
Update exercises/square-root/instructions.md
xanni 1eb6356
Terminate sentences with periods.
xanni 4179cb4
Rephrase introduction.
xanni 6ea8e9c
Update exercises/square-root/instructions.md
xanni 2cdf1d8
Update exercises/square-root/introduction.md
xanni 3453fe4
Further wording changes
xanni 7c932bb
Simplify introduction
xanni 0813370
Replace "output" with "return"
xanni b18c2a2
Remove Wikipedia links
xanni fcc6fb2
Revert "Remove Wikipedia links"
xanni 70066d9
Update exercises/square-root/instructions.md
xanni 5bfbb45
Update exercises/square-root/introduction.md
xanni e460bd5
Clarify requirements
xanni 7486a27
Remove "directly"
xanni 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,18 @@ | ||
| # Instructions | ||
|
|
||
| Your task is to calculate the square root of a given number. | ||
|
|
||
| - Try to avoid using the pre-existing math libraries of your language. | ||
| - As input you’ll be given a positive whole number, i.e. 1, 2, 3, 4… | ||
xanni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - You also only need to output a positive whole number. | ||
xanni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
xanni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Some potential approaches: | ||
|
|
||
| - Linear or binary search for a number that gives the input number when squared. | ||
| - Successive approximation using Newton's or Heron's method. | ||
| - Calculating one digit at a time or one bit at a time. | ||
|
|
||
| You can check out the Wikipedia pages on [integer square root][integer-square-root] and [methods of computing square roots][computing-square-roots] to help with choosing a method of calculation. | ||
xanni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| [integer-square-root]: https://en.wikipedia.org/wiki/Integer_square_root | ||
xanni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [computing-square-roots]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots | ||
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,10 @@ | ||
| # Introduction | ||
|
|
||
| We are launching a deep space exploration rocket and we need a way to make sure the navigation system stays on target. | ||
|
|
||
| As the first step in our calculation, we take a number and find its square root—that is, the number that, when multiplied by itself, equals the given number. | ||
xanni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The journey will be very long. | ||
| To make the batteries last as long as possible, we had to make our rocket’s onboard computer very power efficient. | ||
| Unfortunately that means that we can’t rely on fancy math libraries and functions, as they use more power. | ||
xanni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Instead we want to calculate or approximate the square root directly. | ||
xanni marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.