Hacker Newsnew | past | comments | ask | show | jobs | submit | antonTobi's commentslogin

Here is one possible way of generating all 12 solutions by 2x2x3 choices:

1. Fill the upper left box with 1-2-3-4

2. Choose where to put the 1 in the top right box (2 choices)

3. Choose where to put the 1 in the lower left box (2 choices)

4. Choose which digit to put diagonally opposite the 1 in the lower right box (3 choices)

Is there a nicer way which makes it obvious that there is exactly one solution for each choice in the last step?


> Choose which digit to put diagonally opposite the 1 in the lower right box (3 choices)

There are only two choices there. You cannot put a 1, nor the digit (3 or 4) that’s in the top the column where you try to put the number.

> Is there a nicer way which makes it obvious that there is exactly one solution for each choice in the last step?

There isn’t. You may end up with a degree of freedom after step 4

  1234    1234
  ..1.    ..1.
  ...1    ...1
  .1..    .14.
leads to

  1234
  ..12
  ..21
  2143
which allows for 2 solutions:

  1234    1234
  3412    4312
  4321    3421
  2143    2143

My procedure starts with filling the top-left box, not the top row. So it looks something like this after the third step:

  12..
  34.1
  .1.x
  ..1.
From here x can be any of [2,3,4], and each yields exactly one solution!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: