3 ms·
Wrote a solver for the game 24 as a afternoon project. It's is based on reducing the number of integers in the problem set by 1 in each iteration, and when the
by panda88888 8y ago
Wrote a solver for the game 24 as a afternoon project.
It's is based on reducing the number of integers in the problem set by 1 in each iteration, and when there is only 1 integer left in the problem set, check if it's equal to 24.
The command line prompt assumes 4 numbers inputs but supports custom target number (24 is the default). It can be configured to either tell whether a solution exists or print the actual solutions.