Skip to content

Commit 24c901c

Browse files
github-actionsgithub-actions
authored andcommitted
clang-format and clang-tidy fixes for 2405a14
1 parent 2405a14 commit 24c901c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

backtracking/subset_sum.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
namespace backtracking {
2121
/**
2222
* @namespace Subsets
23-
* @brief Functions for the [Subset Sum](https://en.wikipedia.org/wiki/Subset_sum_problem) problem.
23+
* @brief Functions for the [Subset
24+
* Sum](https://en.wikipedia.org/wiki/Subset_sum_problem) problem.
2425
*/
2526
namespace subset_sum {
2627
/**
@@ -58,31 +59,41 @@ static void test() {
5859
// Test 1
5960
std::cout << "1st test ";
6061
std::vector<int> array1 = {-7, -3, -2, 5, 8}; // input array
61-
assert(backtracking::subset_sum::subset_sum(0, array1) == 2); // first argument in subset_sum function is the required sum and second is the input array
62+
assert(backtracking::subset_sum::subset_sum(0, array1) ==
63+
2); // first argument in subset_sum function is the required sum and
64+
// second is the input array
6265
std::cout << "passed" << std::endl;
6366

6467
// Test 2
6568
std::cout << "2nd test ";
6669
std::vector<int> array2 = {1, 2, 3, 3};
67-
assert(backtracking::subset_sum::subset_sum(6, array2) == 3); // here we are expecting 3 subsets which sum up to 6 i.e. {(1,2,3),(1,2,3),(3,3)}
70+
assert(backtracking::subset_sum::subset_sum(6, array2) ==
71+
3); // here we are expecting 3 subsets which sum up to 6 i.e.
72+
// {(1,2,3),(1,2,3),(3,3)}
6873
std::cout << "passed" << std::endl;
6974

7075
// Test 3
7176
std::cout << "3rd test ";
7277
std::vector<int> array3 = {1, 1, 1, 1};
73-
assert(backtracking::subset_sum::subset_sum(1, array3) == 4); // here we are expecting 4 subsets which sum up to 1 i.e. {(1),(1),(1),(1)}
78+
assert(backtracking::subset_sum::subset_sum(1, array3) ==
79+
4); // here we are expecting 4 subsets which sum up to 1 i.e.
80+
// {(1),(1),(1),(1)}
7481
std::cout << "passed" << std::endl;
7582

7683
// Test 4
7784
std::cout << "4th test ";
7885
std::vector<int> array4 = {3, 3, 3, 3};
79-
assert(backtracking::subset_sum::subset_sum(6, array4) == 6); // here we are expecting 6 subsets which sum up to 6 i.e. {(3,3),(3,3),(3,3),(3,3),(3,3),(3,3)}
86+
assert(backtracking::subset_sum::subset_sum(6, array4) ==
87+
6); // here we are expecting 6 subsets which sum up to 6 i.e.
88+
// {(3,3),(3,3),(3,3),(3,3),(3,3),(3,3)}
8089
std::cout << "passed" << std::endl;
8190

8291
// Test 5
8392
std::cout << "5th test ";
8493
std::vector<int> array5 = {};
85-
assert(backtracking::subset_sum::subset_sum(6, array5) == 0); // here we are expecting 0 subsets which sum up to 6 i.e. we cannot select anything from an empty array
94+
assert(backtracking::subset_sum::subset_sum(6, array5) ==
95+
0); // here we are expecting 0 subsets which sum up to 6 i.e. we
96+
// cannot select anything from an empty array
8697
std::cout << "passed" << std::endl;
8798
}
8899

0 commit comments

Comments
 (0)