Coding Interview - Rosetta Code - 24 game

Seems that the test cases are not allowing all correct solutions. Eg for solve24(‘1234’) a valid solution like (1+2+3)*4 is not accepted.

1 Like

I have the same problem, and it’s saddening.

solve24("4878") should return (7-8/8)*4 or 4*(7-8/8)

while my function is returning

(7*8)-(4*8)

1 Like

Yeah, I got the same problem… I think the tests are poorly written, actually… the correct way to test this function is with the
eval() function, checking if eval of the output maps to 24, and that the digits are there… the way the tests were written is very poor

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

If you want to help writing this in a better way you can check our contribution guidelines: https://contribute.freecodecamp.org/home/