본문 바로가기

LeetCode41

LeetCode 686. Repeated String Match 문제 URL : https://leetcode.com/problems/repeated-string-match/ Repeated String Match - 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 문제 접근법 : a의 문자열 길이를 b보다 클때까지 만들어준다음 a가 b에 속한것이 있는지 확인해주면 끝인문제입니다. 소스코드 : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #include using namesp.. 2021. 7. 31.
LeetCode 572. Subtree of Another Tree 문제 URL : https://leetcode.com/problems/subtree-of-another-tree/ Subtree of Another Tree - 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 문제 접근법 : root의 subtree중 subRoot와 같은것이 있는지 확인합니다. 확인하는 방법은 간단합니다. root의 값이 subroot와 같으면 같은모양인지 확인하면서 왼쪽자식의값과 오른쪽자식의값이 같은지 확인합니다. 다른게 있다면 바로 false.. 2021. 7. 31.
LeetCode 459 Repeated Substring Pattern 문제 URL : https://leetcode.com/problems/repeated-substring-pattern/ Repeated Substring Pattern - 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 문제접근법 : s보다 길이보다 작은 특정길이를 연속적으로 붙여서 s가 만들어지는지 확인하는 문제입니다. s를 만드는 특정 문자열을 t라할때 t의길이 는 s의길이/2 이하여야 합니다. 그래야 s의길이만큼 정확하게 만들수가 있을겁니다. 그렇지만 t의 .. 2021. 7. 31.
LeetCode 38 Count and Say 문제 URL : https://leetcode.com/problems/count-and-say/submissions/ Count and Say - 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 문제접근법 : 문제가 이해하기 어려웠습니다. 이해하기만하면 쉬운데 무슨말인지 이해하려고 찾아보다 이해하고 코드로 짜는건 어렵지 않은 문제입니다. n=1일때 무조건 1입니다. 이건 이해할것없이 문제자체에서 정해줍니다. n=2 부터 n까지는 이전의 숫자가 어떻게 진행되는지 카.. 2021. 7. 15.