본문 바로가기

전체 글

(18)
Number of Subarrays with Bounded Maximum 문제 링크 : https://leetcode.com/problems/number-of-subarrays-with-bounded-maximum/ Number of Subarrays with Bounded Maximum - 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 문제 해설 : 양수가 저장된 배열 nums와 두 양수 left, right가 주어집니다. ( left int: answer = 0 for start in range(len(nums)): maximum..
Matchsticks to Square 문제 링크 : https://leetcode.com/problems/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 문제 해설 : 성냥의 길이가 저장된 배열이 주어집니다. 성냥은 부러뜨릴 수 없지만 이어붙일 수는 있습니다. 모든 성냥을 한 번씩 사용하여 정사각형을 만들 수 있으면 True를, 그럴 수 없으면 False를 반환하세요. 제한 사항 1) 1 bool: total = su..
백준 21609) 상어 중학교(C언어) 문제 링크 : www.acmicpc.net/problem/21609 21609번: 상어 중학교 상어 중학교의 코딩 동아리에서 게임을 만들었다. 이 게임은 크기가 N×N인 격자에서 진행되고, 초기에 격자의 모든 칸에는 블록이 하나씩 들어있고, 블록은 검은색 블록, 무지개 블록, 일반 블록 www.acmicpc.net 구현 문제 중 같은 과정을 반복해서 점수의 총합을 구하는 문제로 다소 복잡한 편입니다. 복잡한 알고리즘은 사용되지 않았지만 코드가 길고 고려해야 할 사항이 많아 자세히 설명하려 합니다. bool type을 표현하기 위해 매크로 TRUE와 FALSE를 각각 1과 0으로 정의했습니다. (C99 표준에는 stdbool.h 헤더파일에 bool 타입이 정의되어 있지만 매크로 사용으로 대체했습니다.) #..