The winner of a fight between a Komodo dragon and a king cobra would probably be the larger animal. Adult Komodo dragons are much larger than adult king cobras, but large king cobras are large enough to kill and eat a juvenile Komodo dragon.
King cobras possess very powerful venom. Although they primarily hunt and eat snakes, they do eat lizards from time to time. Experts disagree as to whether Komodo dragons possess venom or simply have so much bacteria in their mouths that their bites quickly become infected. In either case, few animals that are bitten by a Komodo dragon survive. Large Komodo dragons also derive some protection from their thick skin. Many monitor lizards appear to have some natural immunity to cobra venom and consume them regularly. Monitor lizards generally grab snakes with their strong jaws and thrash them about until they are dead. Occasionally, monitor lizards may use their claws to help dispatch their prey.
Because the ranges of king cobras and Komodo dragons do not overlap, such encounters do not happen in the wild. However, both species do tend to inhabit the trees while they are young to avoid detection by predators. Both species are at risk to predation by other members of their species while they are young.