What you did was stumble across a combination of stuff that "works", but which you don't understand. That's not solving, that's hiding a problem somewhere else.
He may have understood it fine when he wrote it. Just because he can't seem to recall that understanding doesn't mean he didn't solve it. We all run into that sooner or later, drunk or not.
I do agree that he should regain his understanding, test it, fix it if necessary, and probably comment the code. That's the same advice I'd give anyone that had written some code and forgotten how it worked.
"My two cents aren't worth a dime.";