Company: IBM_15june
Difficulty: medium
Closest Ashram Problem Description In the ancient land of Bharatvarsha, the great warrior Arjun is travelling during his exile. He carries a scroll listing the locations of sacred ashrams, each measured in yojanas along a single straight road that runs through Hastinapur. Hastinapur itself sits at location 0 ; a location may be negative (on one side of the city) or positive (on the other). The scroll lists the ashram locations in strictly increasing order. Given Arjun's current location on that same road, report the location of the ashram closest to him. The distance between Arjun at position and an ashram at a is |a - position| (inferred - the source names the quantity "distance" but never writes the formula; on a single road the only consistent reading is the absolute difference of the two locations. All distances are exact integers, so no rounding or square root is involved.) If two ashrams are exactly equally distant from Arjun, he chooses the one closer to Hastinapur , that is, th