[48in24 Exercise] [07-16] Secret Handshake

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 Secret Handshake from Jul 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 Secret Handshake
  • 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.

  • foldleft-and-reverse (scala)
  • foldleft-with-appended-or-prepended (scala)
  • for-loop (java)
  • if-statements-with-reverse (cpp)
  • intstream (java)
  • iterate-once (c, cpp, rust)
  • slice-indexes (go)

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. TypeScript: if statements
    Plain sequence of if statements

  2. Elixir: functional pipeline
    Sequence of function calls

  3. Clojure: functional pipeline via threading macro
    Same sequence of conditions, but functionally

  4. C#: anonymous functions, bitwise shift left based on index, no special case for reverse
    List of anonymous functions and bitwise shift left on index. No special case for reverse

  5. Raku: multi-method and key/value pairs
    Use multi-methods to distinguish between reversing and non-reversing commands

  6. Julia: logical indexing
    Number to true/false values for bit is 1 or 0, then use logical indexing

  7. Nim: compile-time calculation of lookup table
    Pre-compile lookup table for all possible variants

If anyone has more suggestions, do let us know!

Here’s an interesting Raku one:

1 Like
1 Like
1 Like
1 Like