In the second problem, where bhaiya took balls on number line. Why the final answer is 2?
Because as we are finding absolute difference, which means the order of occurrance of word 1 and word 2 does not matter than the answer should have been 1. Because there is one red ball at index 2 and one blue ball at index 3.