Close to 0% chance someone would find out, as that would involve the person revealing the question also facing consequences - unless the company has some elaborate scheme involving modified and unique questions tailored for each candidate, and keeping track what candidate got which question. But that obviously wouldn't work with a trivial question like the one OP got.
Either that, or some third party which could have intercepted the communication between OP and the friend revealing the question. But again, what are the chances...
And on a tangent - should candidates "grinding leetcode" reveal that they've encountered the question before? That's the whole point of leetcode.
I've seen candidates deny that they've seen the problem given, blitz through the basic version (intended as a quick warm-up), and then completely choke when a slight twist is added. Let's just say that really raises some questions...