Can Place Flowers - C++ Solution @ LeetCode
Can Place Flowers, is a LeetCode problem. In this post we will see how we can solve this challenge in C++
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.
Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty), and a number n, return if n new flowers can be planted in it without violating the no-adjacent-fl ....
You can find the full details of the problem Can Place Flowers at LeetCode
Solution: Please check the main.cpp snippet for the solution.
This solution originally posted at: Github by @kamyu104