Welcome to LeetCode Discuss.
This is a place to ask questions related to only OJ problems.
Please read the FAQ to help yourself making the best use of Discuss.
I just used two ways to solve this problem, recursive and iterative solution. And both of the two solutions pass the OJ and they cost almost the same time, even the recursive one better.
So it is not strict with the memory limit, right?
The judge is purposely set to allow a variety of solutions to get accepted. This is so that a reader could explore multiple solutions and experiment with them. If you want the ultimate challenge, try coding a quick sort which is able to pass the judge.
I think sandbox may not be easy to judge on stack usage.. By recursive if you use system stack, it should be fine. (I'm just guessing as I'm not 1337 himself)
No, the judge is able to limit the stack space if I wanted to. For example, if you use the recursive DFS approach for the problem Surrounded Regions, it will result in a Runtime Error.
I relaxed the stack space requirement for this problem so a user is able to experiment with a variety of algorithmic techniques.
Don't know exactly which sandbox do you use, but in general it's not easy. I understand there're variety of ways of doing so, but none of them should throw "runtime error". "runtime error" may give me a hint that the sandbox tries to set the intial stack size as config and doesn't handle stack overflow exception which result in a AV. Is this the approach? :) And my previous answer to that gentleman is tentatively to answer his "memory limit" confuse, which is not seemed resolved in current sandbox as talked above.