Company: eBay MTS 1 - Software Engineer_4july
Difficulty: medium
Given an infinite integer number line, you would like to build some blocks and obstacles on it. Specifically, you have to implement code which supports two types of operations: [1, x] - builds an obstacle at coordinate x along the number line. It is guaranteed that coordinate x does not contain any obstacles when the operation is performed. [2, x, size] - checks whether it's possible to build a block of size size which ends immediately before x on the number line. For example, if x = 6 and size = 2 , this operation checks coordinates 4 and 5 . Produces "1" if it is possible, i.e. if there are no obstacles at the specified coordinates, or produces "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 described above, your task is to return a binary string representing the outputs for all [2, x, size] operations. Example For operations = [[1, 2], [1, 5