Computer Science, asked by Guntaka, 1 month ago

Some boxes are placed in a row and each box can contain maximum one toy. Some of the boxes ar having a toy, and some are not. However, toys cannot be placed in adjacent boxes. Given an integer array of boxes containing O's and 1's, where 0 means empty and 1 means not emp and an integer n, return if n new toys can be placed in the row of box without violating the no- adjacent-toys rule and the position of the boxes shouldn't be disturbed. Example 1: Input: Boxes = [1,0,0,0,1), n = 1 Output: true Example 2 Input: Boxes = [1,0,0,0,1), n = 2 Output: false​

Answers

Answered by wenceclariss
0

Answer:

shouldn't be disturbed. Example 1: Input: Boxes = [1,0,0,0,1), n = 1 Output: true Example 2 Input: Boxes = [1,0,0,0,1), n = 2 Output: false

Explanation:

Some boxes are placed in a row and each box can

Answered by shilpa85475
0

shouldn't be disturbed.

Example 1: Input: Boxes = [1,0,0,0,1), n = 1 Output: true

Example 2 Input: Boxes = [1,0,0,0,1), n = 2 Output: false

Explanation:

each box is placed in a row , since they are not adjacent.

here 0 means empty and 1 means not emp and an integer n.

return if n new toys can be placed in the row of box without violating the no- adjacent-toys rule

the position of the boxes shouldn't be disturbed.

Similar questions