Bus Trip

Solutions Checking if a certain value \(x\) is suitable takes linear time. Intuitively, we have to verify if the array can be splitted into contiguous groups of sum \(x\), without remainder (empty space on the bus is not allowed). This operation consists in iteratively checking the prefix sum of the array against a cumulative value of \(x\). For example: 1 1 2 1 1 1 2 1 3 Suppose we want to the check if 3 works. [Read More]