Heaviest segment problem