코딩테스트/LeetCode
2022. 7. 12.
[LeetCode] Matchsticks To Square
문제링크 Matchsticks to Square - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com matchstick이 담긴 배열 matchsticks가 주어질때 모든 matchstick을 사용하여 하나의 정사각형을 만드는 문제 조건1. stick은 부술수 없고 연결할 수 있다. 조건2. 각각의 stick은 한번만 사용할 수 있다. 접근방법 우선 정사각형이 될 수 있는 조건을 판별해야한다. perimeter : 모든 성냥깨비 길이의 합 sideLen : peri..