mirror of
https://github.com/Manoj-HV30/dsa-competitive-programming.git
synced 2026-05-16 19:35:22 +00:00
20 lines
419 B
Markdown
20 lines
419 B
Markdown
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
|
|
|
|
```
|
|
|