Great topic- It's hard to say which snakes are the smartest, because just like humans or dogs, not every member of a given species is equally-cognizant. My short answeris rattlesnakes & rat snakes, but it will take some time to explain, & some things, I'm not sure that I should, but in any event I'm busy right now & I'll have to come back to this.
I've never met any King cobras so I cannot offer a personal opinion about them, but there was a lady many years ago who free-handled them & lived relatively unscathed until well into her 60's, when a bite from a small young & newly-acquired cobra (not a King) managed just enough of a bite when she was distracted for an interview, and that's how she died...Grace Olive Wiley under-estimated that deadly little thing, in part because it was too small to get its mouth around her hand (they have fixed fangs, not retractable & longer fangs like rattlesnakes do). Anyway, King cobras are known to have been reliably tamed- Wiley is the one I know most about- & that ability of a snake to recognize & remember a human handler as being no threat & without ever trying to bite is surely a sign of their intelligence.