Question: RULES DESC README SETTINGS BACK TO QUESTIONS For Explanation: Codewriting Given an infinite number line, you would like to build few blocks and obstacles

RULES DESC README SETTINGS BACK TO QUESTIONS For Explanation: Codewriting Given an infinite number line, you would like to build few blocks and obstacles on it. Specifically, you have to implement code which supports two types of operations: Example . [1, x) - builds an obstacle at coordinate x along the number line. It is guaranteed that does not contain any obstacles when the operation is performed. coordinate x [2, x, size] - checks whether it's possible to build a block of size size beginning at position For example, for size = 2 and x = 0, it will check o and 1 on the number line for obstacles. Returns 1 if it is possible, i.e. there are no obstacles at the occupied coordinates, and return 0 otherwise. Please note that this operation does not actually build the block, it only checks whether a block can be built. Given an array of operations containing both types of operations above, your task is to return a binary string representing the outputs for all [2, x, size] operations. operations = [[1, 2], [1, 5], [2, 3, 2], [2, 3, 3], [2, 1, 1], [2, 1, 2]] the output should be solution (operations) Let's consider all operations: Question 4 of 4 = "1010" [1, 2] builds an obstacle at coordinate 2 [1, 5] - builds an obstacle at coordinate 5 main. 1 RULES O README SETTINGS DESC < BACK TO QUESTIONS Question 4 of 4 Given an array of operations containing both types of operations above, your Task TS TO Teturn a binary string representing the outputs for all size] operations. Example For operations Explanation: 3, the output should be solution (operations)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
