Ad
  • Default User Avatar

    I'm quite a noob when it comes to improving my algorithms' performance and even more so because I'm quite new to C++, too.
    My solution keeps timing which is okay in my opinion since the code indeed is super uneffecient. However, with quite a lot of testing I think that the output is actually correct - just too slow.

    Can anyone suggest how I could possibly improve my code's performance? I don't really want a full solution or anything related to that.

  • Default User Avatar

    don't std::cout << sum the result but instead use return sum; opposed to your return 0;
    That's why you'll always get 'Actual: 0' because your functionw ill always return 0 in any case.