Skip to content

Commit 5426682

Browse files
author
Hridyanshu7
committed
fixed spelling mistake
1 parent ce00e13 commit 5426682

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: Recursive/SubsetSum.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Algorithm:
2727
* Recursively explore all subsets, either including or excluding each element of the array, here inclusion means subtracting the sum by the element included, finally check if sum equals zero, this would indicate that the sum of all the elements included is equal to the target sum.
2828
*
29+
* @see [Subset Sum Problem](https://en.wikipedia.org/wiki/Subset_sum_problem)
2930
*/
3031

3132
/**
@@ -36,10 +37,11 @@
3637
* @param {number} ind - The current index.
3738
* @return {number} The count of subsets whose sum equals the target sum.
3839
*
40+
* @throws {TypeError} If the input `arr` is not an array of numbers or if the `sum` is not a number.
3941
*/
4042

4143
export function subsetSum(arr, sum, ind = 0) {
42-
//input validation only in the inital call
44+
//input validation only in the initial call
4345
if (
4446
ind === 0 &&
4547
(!Array.isArray(arr) || !arr.every((elem) => typeof elem === 'number'))

0 commit comments

Comments
 (0)