605Can Place Flowers
来源:互联网 发布:上古卷轴5白雪捏脸数据 编辑:程序博客网 时间:2024/06/05 03:22
能种多少花儿
class Solution(object):
def canPlaceFlowers(self, A, N):
"""
:type flowerbed: List[int]
:type n: int
:rtype: bool
"""
for i in range(len(A)):
if (not A[i] and (i == 0 or A[i-1] == 0)
and (i == len(A)-1 or A[i+1] == 0)):
N -= 1
A[i] = 1
return N <= 0
阅读全文
0 0
- 605Can Place Flowers
- LeetCode 605 : Can Place Flowers
- Leetcode 605 Can Place Flowers
- 算法Array-4-605Can Place Flowers
- leet code 605 Can Place Flowers
- leetcode 605[easy]---Can Place Flowers
- 605. Can Place Flowers
- Can Place Flowers
- 605. Can Place Flowers
- 605. Can Place Flowers
- leetcode605. Can Place Flowers
- 605. Can Place Flowers
- 605. Can Place Flowers
- 605. Can Place Flowers
- Can Place Flowers
- leetcode[Can Place Flowers]
- 605. Can Place Flowers
- Can Place Flowers
- update apache
- nRF51822 SDK初体验
- USB/HID设备报告描述符详解
- [YTU]_2436( C++ 习题 输出日期时间--友元类)
- 微分方程的定义
- 605Can Place Flowers
- js面向对象
- ShortUtils
- Day7:日志文件
- 设计模式之建造者模式
- 面向对象用例图
- [YTU]_2437 (C++ 习题 比较大小-类模板)
- svg中fill-rule属性解析
- java project实现ArrayList数据到写入保存到本地Excel