Skip to content

Instantly share code, notes, and snippets.

@albertnetymk
Created December 9, 2017 11:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?

Find the max and min of sum of all permutations of [1..9] satisfying the following condition:

    sum
    == a[1] + a[2] + a[3]
    == a[3] + a[4] + a[5]
    == a[5] + a[6] + a[7]
    == a[7] + a[8]
    where sum = a[0] + a[1]

A permutation satisfying that condition is a = [9,4,1,8,3,2,5,6,7], and sum is 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment