Files
2026-02-11 14:56:22 +05:30

419 B

Should be a hard problem. Core Idea : Fix one number, reduce the problem size, repeat until only two numbers are left, then solve that directly

v.end() : A member function Exists only if v is a container class

end(v) : A free function (std::end) which internally calls v.end(), safer, modern and generic

Main difference:

int arr[] = {1,2,3};

auto a = end(arr);   //  works
auto b = arr.end(); //  ERROR