Update generateCombinations.js by maedemajnoon · Pull Request #2 · Sarehmaturi/javascript-exercises · GitHub
Skip to content

Update generateCombinations.js#2

Open
maedemajnoon wants to merge 1 commit into
Sarehmaturi:Refactorsfrom
maedemajnoon:patch-1
Open

Update generateCombinations.js#2
maedemajnoon wants to merge 1 commit into
Sarehmaturi:Refactorsfrom
maedemajnoon:patch-1

Conversation

@maedemajnoon

Copy link
Copy Markdown

pushed_array is an empty array for storing the result in

helper is a recursive function which takes two parameters; start is the variable that keeps the track of array, current_combination holds the current combination of the main array, it will be spread in the form of an array so it can make a combination in pushed_array
increasing the start amount, the solution can be done on the all elements of array, using pop method it removes the elements added to the current_combination.

sorting the pushed_array in the end, helps to pass the test cause it creates the result in the form that is written there.

solution for generateCombination
Sarehmaturi pushed a commit that referenced this pull request Feb 14, 2025
update average : modify and refactor average problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant