[48in24 Exercise] [05-07] Zebra Puzzle

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 Zebra Puzzle from May 07 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 Zebra Puzzle
  • 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. Kotlin: directly return answer
    The simplest solution :)

  2. Python: check all permutations
    Generate all permutations and then check them for validity

  3. Scala: check only valid permutations
    Generate permutations and before the next permutations, check them for validity

  4. Prolog: logic-based pattern
    Use prolog’s built-in logic solver

  5. C: use unsigned int to encode options and use bit manipulation
    Less than 32 options so uint is enough, use bit manipulation for fast checking

Mention:

  • Total number of permutations is 5!^5=24_883_200_000 which is 24 billion, so filtering is key

If anyone has more suggestions, do let us know!