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 *******
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
Get step-by-step solutions from verified subject matter experts
