It comes out to be wrong when I submit my alg and tells me that it failed to process the input "aa" while I successfully get it right with the input "aa" in my local computer and the "run code" function in the website. Is it the website's bug? Or some differences between the "run code" and "submit" function exists. Or something is wrong with my code.
Yes, you are right. There is a difference between "run code" and "submit". When you input your own code, even if you press the "run code" button and it works, it might not work with other scenarios. For example, (this happened to me once) in the algorithm "Power of Three", your code might be able to match the scenario with the number 9, but not 27. This is because your code might be able to fit three into 9 three times, but that doesn't mean that it is the power of three. For example, 12 can fit 4 threes in it perfectly but the Power of Three means that you multiply 1 with three first, then multiply the product, then do it again, and so on. Those numbers are powers of three.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.