开发平台(Platform): (Ex: Win10, Linux, ...)
MacOS Sierra
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
XCode
问题(Question):
Run code and submit solution 结果不同
喂入的资料(Input):
[-1,0,1,0]
预期的正确结果(Expected Output):
[[-1,0,1]]
错误结果(Wrong Output):
[]
程式码(Code):(请善用置底文网页, 记得排版)
http://codepad.org/tQbV4UCZ
补充说明(Supplement):
LeetCode 15. 3Sum
放到LeetCode上run code 与 submit solution结果不同,点进问题解说中看到
First, please check if you are using any global or static variables.
They are Evil, period. If you must declare one, reset them in the first
line of your called method or in the default constructor.
Why? Because the judger executes all test cases using the same program
instance, global/static variables affect the program state from one test
case to another. See this Discuss thread for more details.
这段英文有看没有懂,有大大可以指教吗?
感谢指教