Company: Myntra_20sep
Difficulty: medium
Minimize Transformer Connection Cost Problem Description In the peaceful village of Jaspur, homes are built neatly along a single long road, and the government is launching a major project to electrify the village. There are N houses in total, numbered consecutively from 1 to N, and each house has a certain power demand - the amount of electricity it needs daily. To distribute electricity efficiently, the government will install exactly K electric transformers, each capable of powering nearby houses. However, a transformer can only be installed on the site of an existing house, and each house must connect to the nearest transformer available. The connection between a house and its nearest transformer requires laying underground electric cables. The cost of laying the cable for a house is calculated as: (distance to nearest transformer) * (power demand of the house) The distance between house i and house j is |i - j| - since all houses lie in a straight line. The government wants to min