GithubHelp home page GithubHelp logo

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

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

from leetcode-go.

Comments (4)

halfrost avatar halfrost commented on May 27, 2024

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

from leetcode-go.

Jack-cin avatar Jack-cin commented on May 27, 2024

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

from leetcode-go.

Jack-cin avatar Jack-cin commented on May 27, 2024

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

from leetcode-go.

halfrost avatar halfrost commented on May 27, 2024

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

from leetcode-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.