Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

霜神,你好,我有时候并最优解的go代码转成python之后,时空复杂度就变的很差,是不是语言的问题?目前上传的这一千多道题都基本上是go的最优解吗? #275

Open
Jack-cin opened this issue Aug 5, 2023 · 4 comments

Comments

@Jack-cin
Copy link

Jack-cin commented Aug 5, 2023

No description provided.

@halfrost
Copy link
Owner

halfrost commented Aug 5, 2023

是 go 最优解,不信你可以复制我的代码,去 leetcode 提交。你举几个例子,哪些题用 python 改写了,性能变的很差?

@Jack-cin
Copy link
Author

Jack-cin commented Aug 6, 2023

比如
[632. Smallest Range Covering Elements from K Lists]:image
[1235. Maximum Profit in Job Scheduling]: image

@Jack-cin
Copy link
Author

Jack-cin commented Aug 6, 2023

是不是python的问题,这个语言好像本身就性能不太好?

@Jack-cin Jack-cin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
@Jack-cin Jack-cin reopened this Aug 6, 2023
@halfrost
Copy link
Owner

halfrost commented Aug 6, 2023

@Jack-cin 他们网站后台数据加强了。我用 Go 的代码又提交了一次,632 降低到 88.89%,1235 降低到 93.33% 。至于 Python 的版本,有些翻译过来的实现,需要更改。Go 的 runtime 和 Python 不一样,所以直接翻译过来耗时和内存都不一样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants