Why do I get: -9223372036854775808
The one glaring error is this: Since maxPower is 50, you are accessing an element that’s out of bounds. This is undefined behavior Also, to make the code legal C++, either declare an array of 50: or declare a std::vector<int64_t>. When you do that and use at() instead of [], then you get a better view of how your program breaks. See the … Read more