Hacker News new | ask | show | jobs
by adotbacon 798 days ago
Yeah, the [n,n+1] is only a problem when there isn't enough wiggle room between the numbers. ex: [2,3] and [3,4]

[3,4]

--> [1,2,4] --> 4 can't split because 2/2 and 3/1 are invalid

--> 4 can't initially split because 2/2 and 3/1 are both invalid

[5,6] --> [5,4,2] --> [5,1,3,2] --> [6,3,2] --> [6,5]

[7,8] --> [7,3,5] --> [7,1,2,5] --> [8,2,5] --> [8,7]

When you add more numbers, you need more wiggle room. So, [4,5,6] is problematic and probably [5,6,7].

[4,5,6]

--> [3,1,5,6] --> 6 can't break into 3, nor 5/1. It can do 4/2, but then 5 can't split. 5 also can't split.

--> [4,2,3,6] --> [4,2,3,1,5] --> [6,4,5] --> 4 can't split into 2/2. It can split to 3/1 but then 5 can't split

--> 6 can't initially split at all because 3/3, 4/2, and 5/1 are invalid

Even if [6,7,8] has a solution, I'm sure [6,7,8,9] does not.

1 comments

A solution for [6,7,8,9]:

6,7,8,9

6,3,4,8,9

6,3,4,8,2,7

9,4,8,2,7

9,4,8,2,1,6

9,4,3,5,2,1,6

9,7,5,2,1,6

9,7,5,3,6

9,7,8,6

9,5,2,8,6

9,5,2,1,7,6

9,5,3,7,6

9,8,7,6

Wow, well done! I found [6,7,8] as well:

6,7,8

6,7,5,3

6,7,1,4,3

6,8,4,3

6,8,7

6,3,5,7

6,2,1,5,7

8,1,5,7

8,6,7

8,4,2,1,6

8,4,3,6

8,7,6