Repository: TheAlgorithms/C-Plus-Plus
File: dynamic_programming/subset_sum.cpp (C++)

Code before:
/**
 * @file
 * @brief Implements [Sub-set sum problem]
 * (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells
 * whether a subset with target sum exists or not.
 *
 * @details
 * In this problem, we use dynamic programming to find if we can pull out a 
 * subset from an array whose sum is equal to a given target sum. The overall 
 * time complexity of the problem is O(n * targetSum) where n is the size of 
 * the array. For example, array = [1, -10, 2, 31, -6], targetSum = -14. 
 * Output: true => We can pick subset [-10, 2, -6] with sum as 
 * (-10) + 2 + (-6) = -14.
 * @author [KillerAV] (https://github.com/KillerAV)
 */

#include <cassert>    // for std::assert
#include <iostream>   // for io operations
#include <vector>   // for vector
#include <unordered_map>   // for unordered map

/**
 * @namespace dynamic_programming
 * @brief Dynamic Programming algorithms
 */
namespace dynamic_programming {

/**
 * @namespace subset_sum
 * @brief Functions for [Sub-set sum problem]
 * (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm
 */
namespace subset_sum {

/**
 * Recursive function using dynamic programming to find if the required sum 
 * subset exists or not.
 * @param arr input array
 * @param targetSum the target sum of the subset
 * @param dp the map storing the results
 * @returns true/false based on if the target sum subset exists or not.
 */
bool subset_sum_recursion(
    const std::vector<int> &arr, 
    int targetSum, 

Review comment (suggestion):
```suggestion
#include <cassert>        /// for std::assert
#include <iostream>       /// for IO operations
#include <vector>          /// for std::vector
#include <unordered_map>   /// for unordered map
```


Code after:
/**
 * @file
 * @brief Implements [Sub-set sum problem]
 * (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm, which tells
 * whether a subset with target sum exists or not.
 *
 * @details
 * In this problem, we use dynamic programming to find if we can pull out a 
 * subset from an array whose sum is equal to a given target sum. The overall 
 * time complexity of the problem is O(n * targetSum) where n is the size of 
 * the array. For example, array = [1, -10, 2, 31, -6], targetSum = -14. 
 * Output: true => We can pick subset [-10, 2, -6] with sum as 
 * (-10) + 2 + (-6) = -14.
 * @author [KillerAV](https://github.com/KillerAV)
 */

#include <cassert>        /// for std::assert
#include <iostream>       /// for IO operations
#include <vector>          /// for std::vector
#include <unordered_map>   /// for unordered map

/**
 * @namespace dynamic_programming
 * @brief Dynamic Programming algorithms
 */
namespace dynamic_programming {

/**
 * @namespace subset_sum
 * @brief Functions for [Sub-set sum problem]
 * (https://en.wikipedia.org/wiki/Subset_sum_problem) algorithm
 */
namespace subset_sum {

/**
 * Recursive function using dynamic programming to find if the required sum 
 * subset exists or not.
 * @param arr input array
 * @param targetSum the target sum of the subset
 * @param dp the map storing the results
 * @returns true/false based on if the target sum subset exists or not.
 */
bool subset_sum_recursion(
    const std::vector<int> &arr, 
    int targetSum,