X interview question

box coloring question, and also left and right subarray sum question.