There aren't very many animals out there that could fight a king cobra and eat it for dinner, but a mongoose is one of them.
Before we go any further, let's talk about mongooses in general. Have you ever seen a mongoose? There are 29 species of them, and not all of them look the same. They are all, however, long-bodied, short-eared weasley-looking animals, some of which attack and eat venomous snakes. They aren't very closely related to weasels, though — if you're an animal in the order Carnivora, the order of mammals that are mostly carnivorous and have teeth adapted for flesh eating, you can either be on Team Dog or Team Cat. Weasels are related to dogs and, however much mongooses look like weasels, they are firmly on Team Cat. (In fact, a meerkat is a mongoose — "cat" is right there in its name!)
Mongooses are colonial animals, meaning they live in colonies, and most species live in Africa, although one species, the Javan mongoose (Herpestes javanicus), has been introduced to Europe and has also wreaked havoc in ecosystems all over the world — especially on islands like Hawaii, Puerto Rico and Jamaica. Although mongooses are small, they're bright, feisty and are what scientists call "nondiscriminatory predators." If they can catch it or kill it, they'll eat it — and an animal like that can do a lot of damage on an island.
But how can it be that a skinny mongoose can take on one of the most venomous snakes in the world — like the hulking king cobra (Ophiophagus hannah), whose venom can kill an adult human in around 30 minutes? The grudge match that was popularized in Rudyard Kipling's 1894 short story "Rikki-Tikki-Tavi" is a mystifying one, but a few specialized traits have allowed mongooses to add venomous snakes to their list of entrées.
For starters, mongooses are quick and agile, and have strong jaws and thick hides to block those scary cobra fangs. They also don't mind rushing a cobra, which is, in spite of its size and extravagantly toxic venom, actually very shy and uninterested in tangling with anybody. Combative humans and mongooses are at the very top of a king cobra's "Avoid" list.
But then chemistry gets involved. It's not impossible for a mongoose to get sick or even die from a cobra bite, but mongooses make a glycoprotein that binds to the protein in the venom so a moderate amount of snake venom won't hurt them.
Fascinating creatures, mongooses. However, if you live in the United States, you definitely can't have one as a pet — they are prohibited animals in every state except Hawaii, where they are considered a dangerous invasive species.