LeetCode Weekly Contest 13-Matchsticks to Square【中】

这是一道关于利用给定长度的火柴棒拼成一个正方形的问题。题目要求不能折断火柴,每根必须用一次。输入是火柴棒的长度数组,输出是能否拼成正方形的布尔值。例如,输入[1,1,2,2,2]时,可以拼成边长为2的正方形,因此输出为true;而输入[3,3,3,3,4]时,无法拼成正方形,输出为false。注意,火柴棒长度之和在0到10^9之间,数组长度不超过15。" 80738291,6994092,神经网络搭建与优化实战,"['神经网络', '深度学习', '模型优化', '损失函数', '正则化']
摘要由CSDN通过智能技术生成

Matchsticks to Square

Rememberthe story of Little Match Girl? By now, you know exactly what matchsticks thelittle match girl has, please find out a way you can make one square by usingup all those matchsticks. You should not break any stick, but you can link themup, and each matchstick must be used exactly one time.

Yourinput will be several matchsticks the girl has, represented with their sticklength. Your output will either be true or false, to represent whether you cansave this little girl or not.

Example1:

Input:[1,1,2,2,2]

Output:true

<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值