← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an array of 4 integers called cards, where each integer is between 1 and 9 (inclusive). Your task is to determine if you can arrange these four numbers using mathematical operations and parentheses to create an expression that evaluates to exactly 24.
You can use the following operators between any two numbers: Addition +, Subtraction -, Multiplication *, Division /. You can also use parentheses ( and ) to control the order of operations.
Important restrictions:
The function should return true if it's possible to create an expression using all four cards exactly once that evaluates to 24, and false otherwise.