您的位置:首页 > 其它

LeetCode中runcode结果和sublime结果不一致的原因

2017-12-05 13:29 295 查看
很有可能是设置了全局变量的原因。

官方解释:

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.

根据以上提示,修改代码,尽量不使用全局变量
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐