Trains the technique from
LeetCode 67924 GameThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A tabletop puzzle deals four numbered chips, given in cards, each showing a digit from 1 to 9.
The aim is to write an arithmetic line worth exactly 24 under these rules:
+, -, * and /, and brackets may be placed however you like.All arithmetic is exact, and the line has to come to 24 exactly rather than close to it. Return true when such a line exists and false otherwise.
Example 1
The line 5 * (5 - 1 / 5) is worth 24, since 1 / 5 is one fifth, 5 minus one fifth is four and four fifths, and five times that is 24.
Example 2
Every line that can be written from four ones is worth at most 4, so 24 is out of reach.
Example 3
The line 1 * 2 * 3 * 4 is worth 24.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def judge_point24(cards: list[int]) -> bool:public boolean judgePoint24(int[] cards)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.