MCPcopy Create free account
hub / github.com/codereport/Content / solve

Function solve

Talks/2019-05-CppNow/AlgorithmIntuition/Slide-032.cpp:3–12  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1// Solution 3a
2 
3auto solve() -> int {
4   vector v = { 2, 1, 3, 5, 4 };
5   auto a = numeric_limits<int>::max();
6   auto b = numeric_limits<int>::min();
7   for (auto e : v) {
8      a = min(a, e);
9      b = max(b, e);
10   }
11   return b - a;
12}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected