deffunc(flowerbed, n):
res =0
lenth =len(flowerbed)if lenth ==1:if flowerbed[0]==0:
res +=1return res>=n
if lenth ==2:if flowerbed[0]==0and flowerbed[1]==0:
res +=1return res>=n
for i inrange(0, lenth-1):if i ==0and flowerbed[0]==0and flowerbed[1]==0:
res +=1
flowerbed[0]=1if flowerbed[i-1]==0and flowerbed[i+1]==0and flowerbed[i]==0:
flowerbed[i]=1
res +=1if flowerbed[-1]==0and flowerbed[-2]==0:
res +=1
flowerbed[-1]=1return res>=n
print(func(flowerbed =[1], n =2))