From 4827805a0a43dcbe1ef99544ee984532feac1eae Mon Sep 17 00:00:00 2001 From: Swastika Gupta <64654203+Swastyy@users.noreply.github.com> Date: Mon, 28 Jun 2021 17:45:32 +0530 Subject: [PATCH] Update subset_sum.cpp --- backtracking/subset_sum.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backtracking/subset_sum.cpp b/backtracking/subset_sum.cpp index b4e10bf17..6213206de 100644 --- a/backtracking/subset_sum.cpp +++ b/backtracking/subset_sum.cpp @@ -27,22 +27,22 @@ namespace Subsets { * @returns count of the number of subsets with required sum */ -std::uint64_t subset_sum(int sum, std::vector &in_arr) { +std::uint64_t subset_sum(int sum, const std::vector &in_arr) { int nelement = in_arr.size(); //number of subset element int count_of_subset = 0; - for(int i=0; i < (1 << (nelement)); i++) { + for (int i=0; i < (1 << (nelement)); i++) { std::vector subset; - for( int j=0 ; j < nelement ; j++) { + for ( int j=0 ; j < nelement ; j++) { if (i & (1<