I submitted the same solution twice for the problem https://leetcode.com/problems/serialize-and-deserialize-binary-tree/.
The results are as below:
Submission 1: Runtime - 39 ms, Memory - 65.7 MB
Submission 2: Runtime - 13 ms, Memory - 42 MB
Both submissions had exact same code in the same language (java).
Can someone from https://leetcode.com/ explain this?