From 3b8dbf00368c285bafd87bd948fa657f6f280b12 Mon Sep 17 00:00:00 2001 From: Lajat5 Date: Tue, 9 Nov 2021 15:56:25 +0000 Subject: [PATCH] Fix #2 --- dynamic_programming/partition_problem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamic_programming/partition_problem.cpp b/dynamic_programming/partition_problem.cpp index 1625e5327..fe49f78ed 100644 --- a/dynamic_programming/partition_problem.cpp +++ b/dynamic_programming/partition_problem.cpp @@ -49,7 +49,7 @@ namespace dp { * @param size Size of the vector. * @returns @param bool whether the vector can be partitioned or not. *******************************************************************************/ - bool findPartiion(std::vector &arr, uint64_t size) { + bool findPartiion(const std::vector &arr, uint64_t size) { uint64_t sum = std::accumulate(arr.begin() , arr.end() , 0); // Calculate sum of all elements if (sum % 2 != 0) return false; //if sum is odd, it cannot be divided into two equal sum