We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7267e8c commit 3b8dbf0Copy full SHA for 3b8dbf0
dynamic_programming/partition_problem.cpp
@@ -49,7 +49,7 @@ namespace dp {
49
* @param size Size of the vector.
50
* @returns @param bool whether the vector can be partitioned or not.
51
*******************************************************************************/
52
- bool findPartiion(std::vector<uint64_t> &arr, uint64_t size) {
+ bool findPartiion(const std::vector<uint64_t> &arr, uint64_t size) {
53
uint64_t sum = std::accumulate(arr.begin() , arr.end() , 0); // Calculate sum of all elements
54
55
if (sum % 2 != 0) return false; //if sum is odd, it cannot be divided into two equal sum
0 commit comments