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
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
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
Hindi,
17 days ago
Math,
17 days ago
Accountancy,
1 month ago
Math,
1 month ago
Science,
9 months ago
Political Science,
9 months ago
Math,
9 months ago