Skip to content

Instantly share code, notes, and snippets.

@ilpropheta
Last active February 17, 2016 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilpropheta/6e2b7629105f5d7a9269 to your computer and use it in GitHub Desktop.
Save ilpropheta/6e2b7629105f5d7a9269 to your computer and use it in GitHub Desktop.
vector<int> elems = ...;
auto minDiff = numeric_limits<int>::max();
for (auto i=0; i<elems.size()-1; ++i)
{
minDiff = min(elems[i+1]-elems[i], minDiff);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment