Have you ever sat down on a train to have your friend poke you, point to the train's carriage number and ask, "Can you make 10?"
This project is a web app that shows you how to make 10, given the 4 numbers in your train's carriage.
For example,
Input: Numbers = [1, 2, 3, 4] and Goal = 10
Output: A list of solutions, one of them being: (1x2x3)+4 = 10
See: https://make10.sanjayn.com
$ npm install && npm start
The main steps can be broken down into two main steps:
- Generate all possible post-fix expressions involving the 4 numbers with the operations (+, –, x, ÷).
- Evaluate each postfix operation by using standard stack operations and check if the result is equal to the goal.
An additional constraint that I placed upon myself for this project was to implement all permutations, combinations and evaluating lib functions without external mathematical libraries.
Read more at: https://sanjayn.com/make10/ for further details.