The giraffe's neck, which may grow to be two metres long, was chosen because it gives the giraffe exclusive access to the tree's topmost leaves, which no other animal can reach.
Thus to survive and avoid competition for food, giraffe neck adapted to feed on different parts of the tree.