Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 1.04 KB

10.md

File metadata and controls

18 lines (14 loc) · 1.04 KB

10a

I'm not learning much from my earlier note on making a plan before executing. So 10a was done before writing this. Basically, I just sorted the list, since you had to use all of them, just calculate the difference between the element and the next one, making sure to add a 0 to the head, and val[length] + 3 to the last item. Then count 1's and threes.

10b

Given the list of deduced differences;

[1,1,1,1,3,1,1,1,1,3,1,1,1,1,3,1,1,1,1,3,1,1,3,1,1,3,1,1,1,1,3,3,3,1,1,1,1,3,3,1,1,1,1,3,1,1,3,1,3,3,1,1,1,1,3,3,1,1,3,1,1,1,1,3,1,1,1,3,1,1,1,1,3,1,1,1,3,1,1,3,1,1,1,1,3,1,1,1,1,3,1,3,1,1,1,1,3]

We can state the following; [1] = 1 permutation (2 ^ 1-1) = 1 [1, 1] == [2] == 1 + 1 steps (2 ^ 2-1) = 2 [1a, 1b, 1c] == [2, 1] == [2, 1] == [1, 2] 3 extra permutations (2 ^ 3-1) = 4 [1a, 1b, 1c, 1d] == [2, 1c, 1d] == [1a, 2(a), 1d] == [1a, 2(b), 1d]== [3, 1] == [3, 1] == [1, 3] (we can't go to 4)

I.e. Any sequence of 1s = 2^(n-1). So if we take the diff of 1s, we should be able to calculate the total permutations.