
[LeetCode] 605. Can Place Flowers
·
코딩테스트/Python
🔗 Problem Linkhttps://leetcode.com/problems/can-place-flowers/description❔Thinking0과 1로만 이루어진 flowerbed 배열이 주어질 때 주어진 꽃을 모두 심을 수 있다면 True, 아니라면 False를 반환한다.0인 곳에 꽃을 하나 심을 수 있고, 1이 인접하지 않아야 한다. (ex - [1,1], [0,1,1] 불가능)💻Solution1. 초기 풀이def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: flowers = 0 if flowerbed == [0] or (flowerbed == [1] and n == 0): return True elif flow..