-
-
Notifications
You must be signed in to change notification settings - Fork 1
Added Workshop 4 - Arithmetic Progression #2
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for cyf-codewars-workshops ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
This looks great!
I'm generally trying to avoid generated files in this repo, but the starter code is handy so we should definitely include it.
It'd probably be handy to establish a convention like a couple of optional directories in a problem:
- solution
- starter-code
Solution we would probably just host in the repo and not publish on the website, and we could zip up starter-code into a zip file as part of the build process and host it? WDYT?
This is important to our solution. | ||
|
||
1. How many ways can you find to compute the **difference** between terms from the given list (ie the list with one value missing)? | ||
1. We can reply on the first and last values as being present, so can you compute the difference using only the first and last values? |
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.
1. We can reply on the first and last values as being present, so can you compute the difference using only the first and last values? | |
1. We can rely on the first and last values as being present. Can you compute the difference using only the first and last values? |
|
||
## How to find the 'difference' | ||
|
||
In the full sequence `[1, 3, 5, 7, 9]`, the **difference** is 2. We can also think of it as the "gaps" between terms being the list `[2, 2, 2, 2]`. Note that the length of the full sequence is `5` but the number of "gaps" is only `4` (ie, length of the list `[2, 2, 2, 2]`). |
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.
In the full sequence `[1, 3, 5, 7, 9]`, the **difference** is 2. We can also think of it as the "gaps" between terms being the list `[2, 2, 2, 2]`. Note that the length of the full sequence is `5` but the number of "gaps" is only `4` (ie, length of the list `[2, 2, 2, 2]`). | |
In the full sequence `[1, 3, 5, 7, 9]`, the **difference** is 2. We can also think of it as the "gaps" between terms being the list `[2, 2, 2, 2]`. Note that the length of the full sequence is `5` but the number of "gaps" is only `4` (i.e., length of the list `[2, 2, 2, 2]`). |
|
||
This is important to our solution. | ||
|
||
1. How many ways can you find to compute the **difference** between terms from the given list (ie the list with one value missing)? |
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.
1. How many ways can you find to compute the **difference** between terms from the given list (ie the list with one value missing)? | |
1. How many ways can you find to compute the **difference** between terms from the given list (i.e. the list with one value missing)? |
|
||
## Computing the difference | ||
|
||
There is a way of computing the difference easily from the first and last value in the sequence. It relies on the fact that given the full sequence has `len` values in it, there are `len - 1` "gaps" and this gap is constant (ie it is the same every time). |
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.
There is a way of computing the difference easily from the first and last value in the sequence. It relies on the fact that given the full sequence has `len` values in it, there are `len - 1` "gaps" and this gap is constant (ie it is the same every time). | |
There is a way of computing the difference easily from the first and last value in the sequence. It relies on the fact that given the full sequence has `len` values in it, there are `len - 1` "gaps" and this gap is constant (i.e. it is the same every time). |
|
||
### What you should already know | ||
|
||
You should have attended the previous two problem solving sessions. You will have learned the outline procedure for solving problems by: |
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.
You should have attended the previous two problem solving sessions. You will have learned the outline procedure for solving problems by: | |
You should have attended the previous three problem solving sessions. You will have learned the outline procedure for solving problems by: |
Added workshop 4: Find the missing number in an arithmetic progression