@@ -0,0 +1,794 @@
+package array;%0A%0A/**%0A * 605. Can Place Flowers%0A */%0Apublic class CanPlaceFlowers %7B%0A    public static void main(String%5B%5D args) %7B%0A        int%5B%5D flowerbed = new int%5B%5D %7B1, 0, 0, 0, 0, 1%7D;%0A        int n = 2;%0A        System.out.println(canPlaceFlowers(flowerbed, n));%0A    %7D%0A%0A    public static boolean canPlaceFlowers(int%5B%5D flowerbed, int n) %7B%0A        if (flowerbed.length == 1 && flowerbed%5B0%5D == 0 && n == 1)%0A            return true;%0A        int twiceZero = 0;%0A        for (int i = 0; i %3C flowerbed.length - 1; i++) %7B%0A            twiceZero = (flowerbed%5Bi%5D %7C flowerbed%5Bi + 1%5D) == 0 ? twiceZero + 1 : 0;%0A            if ((i == 0 %7C%7C i == flowerbed.length - 2) && twiceZero == 1 %7C%7C twiceZero == 2) %7B%0A                n--;%0A                twiceZero = 0;%0A            %7D%0A        %7D%0A        return n %3C= 0;%0A    %7D%0A%7D%0A

add leetcode no.605