C++ Biggest and Second Biggest
Just one linear scan to find the biggest m1, and the second biggest m2 numbers.\n\ncpp\nint maxProduct(vector<int>& nums) {\n\tauto m1 = 0, m2 = 0;\n\tfor (auto
Just one linear scan to find the biggest `m1`, and the second biggest `m2` numbers.\n\n```cpp\nint maxProduct(vector<int>& nums) {\n\tauto m1 = 0, m2 = 0;\n\tfor (auto n: nums) {\n\t\tif (n > m1)\n            m2 = exchange(m1, n);\n\t\telse\n\t\t\tm2 = max(m2, n);\n\t}\n\treturn (m1 - 1) * (m2 - 1);\n}\n```
[]