[48in24 Exercise] [04-16] Difference of Squares

This issue is a discussion for contributors to collaborate in getting ready to be featured in 48in24. Please refer to this forum topic for more info.


We will be featuring Difference of Squares from Apr 16 onwards.

Staff jobs

These are things for Erik/Jeremy to do:

  • ☐ Check/update exercise in Problem Specifications
  • ☐ Create + schedule video

Community jobs

For each track:

  • Implement Difference of Squares
  • Add approaches (and an approaches introduction!) for each idiomatic or interesting/educational approach.
  • Add video walkthroughs (record yourself solving and digging deeper into the exercise).
  • Highlight up to 16 different featured exercises (coming soon)

Existing Approaches

You can use these as the basis for approaches on your own tracks. Feel free to copy/paste/reuse/rewrite/etc as you see fit! Maybe ask ChatGPT to translate to your programming language.

Track Statuses

You can see an overview of which tracks have implemented the exercise at the #48in24 implementation status page.

I’ve currently gathered the following solutions to feature:

  1. C#: for loops
    Use plain for loops

  2. Erlang: manual recursion
    Use recursion

  3. Elm: functional pipeline
    Use a functional pipeline

  4. Haskell: using range syntax and built-in functions
    Use range syntax and built-in functions

  5. R: ranges and vectorized operation
    Use ranges and a vectorized operation to compute difference

  6. Fortran: use formulas to directly calculate square sums
    Both square of sum and sum of squares can be calculated using formulas

  7. Julia: use formulas for all three functions
    Define polynomials for all three functions and solve them

If anyone has more suggestions, do let us know!