Skip to content

Added Workshop 4 - Arithmetic Progression - #2

Open
beaumoaj wants to merge 4 commits into
CodeYourFuture:mainfrom
beaumoaj:ArithmeticProgression
Open

beaumoaj wants to merge 4 commits into
CodeYourFuture:mainfrom
beaumoaj:ArithmeticProgression

Conversation

@beaumoaj

@beaumoaj beaumoaj commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

Added workshop 4: Find the missing number in an arithmetic progression

@netlify

netlify Bot commented Sep 1, 2025

Copy link
Copy Markdown

Deploy Preview for cyf-codewars-workshops ready!

Name Link
🔨 Latest commit 36dffcc
🔍 Latest deploy log https://app.netlify.com/projects/cyf-codewars-workshops/deploys/68b6ef019cccf50008d4ebec
😎 Deploy Preview https://deploy-preview-2--cyf-codewars-workshops.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@illicitonion illicitonion left a comment

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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]`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants