Inspiration
I was inspired by learning how represent a sum in as many different ways as possible
What it does
It takes a number and finds every combination of numbers that make up the number, however you can input the numbers that you want to be used.
How we built it
To build it I made a recursive algorithm that loops through every number in the numbers list. It keeps calling the function but every time the sum goes down by the number used. If the sum eventually reaches 0 a solution is found, if the sum is less than zero than it is invalid. Before adding the solution to the solution list, it sorts the solution and checks it against all other combinations to make sure that the same solution is not done twice, just in a different order.
Challenges we ran into
Sorting the lists so that they were able to not have any duplicates was difficult. This problem was solved by creating a list with all already tried combinations that were sorted by numerical order. The solution is then compared to this list to see if it already exists.
Accomplishments that we're proud of
I'm proud that I was able to finish it in such a short amount of time and that I was able to make my own way of solving the problem. In the past when making things like A* or minimax I needed lots of tutorials and proof of concepts for me to be able to make a working product. However, for this project I was able to do it without any outside help.
What we learned
The biggest thing that I learned was becoming more familiar with recursive algorithms. I really enjoy coding them however, they can sometimes be really frustrating.
What's next for Sum finder
More improvements, like faster run times would be a nice touch. Also being able to find when the inputs are invalid so that it doesn't output an error.
Log in or sign up for Devpost to join the conversation.