Question: ****MIPS ASSEMBLY ******* You have a garden in which some of the plots are planted, and some are not. However, trees cannot be planted in

****MIPS ASSEMBLY ***********MIPS ASSEMBLY ******* You have a garden in which some of the

You have a garden in which some of the plots are planted, and some are not. However, trees cannot be planted in adjacent plots. Given an integer array garden containing O's and I's, where 0 means empty and 1 means not empty, and an integer n, write an assembly program to output if n new trees can be planted in the flowerbed without violating the no- adjacent-trees rule. Sample test case 1: Input: garden [1,0,0,0,1), n = 1 Output: true, new garden = [1,0,1,0,1] Sample test case 2: Input: garden [1,0,0,0,1), n = 2 Output: false Sample test case 3: Input: garden [1,0,0,0,0,0,1), n = 2 Output: true, new garden = [1,0,1,0,1,0,1]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!