Skip to main content
1 of 15
Noodle9
  • 20.3k
  • 3
  • 21
  • 46

C++ (clang), 280 bytes

#import<bits/stdc++.h>
using namespace std;using V=vector<int>;V f(V&v){vector<V>w;map<int,int>m;sort(v.begin(),v.end());for(int a:v)for(int b:v)for(int c:v)if(a+b+c==v.back()){V x={a,b,c};sort(x.begin(),x.end());m[x[2]-x[0]]=w.size();w.push_back(x);}return w[m.begin()->second];}

Try it online!

Noodle9
  • 20.3k
  • 3
  • 21
  • 46