leet code 605 Can Place Flowers
来源:互联网 发布:域名找回 编辑:程序博客网 时间:2024/06/08 20:08
class Solution { public boolean canPlaceFlowers(int[] flowerbed, int n) { int count=0; for(int i=0;i<flowerbed.length && count<n;i++){ if(flowerbed[i]==0 && (i == 0 || flowerbed[i-1]==0) && (i == flowerbed.length-1 || flowerbed[i+1]==0)){ flowerbed[i]=1; count++; } } return count==n; }}
阅读全文
0 0
- leet code 605 Can Place Flowers
- 605Can Place Flowers
- LeetCode 605 : Can Place Flowers
- Leetcode 605 Can Place Flowers
- 算法Array-4-605Can 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
- (伪分布式)zookeeper+solr搭建集群(1)
- listView图片与文字显示
- angular js 利用filter进行排序
- java基础知识总结(二)
- POJ 2446 Chessboard 二分图
- leet code 605 Can Place Flowers
- js中top、clientTop、scrollTop、offsetTop的区别 文字详细说明版
- command line interface
- 上传头像
- io流小结
- 15. 3Sum
- Java基础知识总结(三)
- 如何从零开始开发一款嵌入式产品(20年的嵌入式经验)(转载)
- SpringBoot学习:SpringBoot整合mybatis