Skip to main content
deleted 87 characters in body
Source Link
MarcMush
  • 6.6k
  • 13
  • 17

Julia 1.0Julia 1.7 + Combinatorics, 8974 bytes

using Combinatorics
~x=(p=[partitions(x)...])[argmin(keys.((S=p.|>i->sum.(i)).∪0).=>S)]
using Combinatorics
~x=argmin(p->keys(sum.(p)∪0)=>sum.(p),partitions(x))

Try it online!Attempt This Online!

argmin(f, itr) needs julia 1.7 or later

Julia 1.0 + Combinatorics, 89 bytes

using Combinatorics
~x=(p=[partitions(x)...])[argmin(keys.((S=p.|>i->sum.(i)).∪0).=>S)]

Try it online!

Julia 1.7 + Combinatorics, 74 bytes

using Combinatorics
~x=argmin(p->keys(sum.(p)∪0)=>sum.(p),partitions(x))

Attempt This Online!

argmin(f, itr) needs julia 1.7 or later

Source Link
MarcMush
  • 6.6k
  • 13
  • 17

Julia 1.0 + Combinatorics, 89 bytes

using Combinatorics
~x=(p=[partitions(x)...])[argmin(keys.((S=p.|>i->sum.(i)).∪0).=>S)]

Try it online!