Trains the technique from
LeetCode 633Sum of Square NumbersThis 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 groundworks firm has taken delivery of exactly c identical square slabs and wants to lay two square courts with them, using up every slab and cutting none.
A court is a solid square block, so a court whose side measures s slabs swallows s * s slabs. A side of zero slabs is allowed and simply means that court is not laid at all.
Return true if some choice of the two side lengths uses the delivery up exactly, and false if some slabs would always be left over.
Example 1
Two courts of side two each swallow four slabs, which accounts for all eight.
Example 2
Every pairing of side lengths either leaves slabs in the yard or calls for more than were delivered.
Example 3
A court of side five swallows twenty-five slabs and a court of side one swallows the last slab.
Example 4
Nothing was delivered, and two courts of side zero use up nothing.
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_square_sum(c: int) -> bool:public boolean judgeSquareSum(int c)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.