V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Youthink
V2EX  ›  LeetCode

在 leetcode 上用 javaScript 刷题,有一起的小伙伴吗?

  •  
  •   Youthink · 2016-03-19 00:19:18 +08:00 · 15084 次点击
    这是一个创建于 2932 天前的主题,其中的信息可能已经有所发展或是发生改变。

    好吧,身为计科的学生,我都不好意思说,我快一年没刷过题了。做几个题找找感觉。刚开始做,有一起的小伙伴吗?

    我的答案:GitHub

    39 条回复    2019-08-25 20:04:19 +08:00
    mikicomo
        1
    mikicomo  
       2016-03-19 00:52:42 +08:00
    竟然用 js 刷题, follow , doge :
    roku
        2
    roku  
       2016-03-19 01:12:50 +08:00
    在用 python 刷
    dnshi
        3
    dnshi  
       2016-03-19 08:33:24 +08:00   ❤️ 1
    我好早之前写过 Leetcode 。现在因为有份不错的工作,所以现在做题已经少多了。更多的是在玩各种前端的玩意。

    我也是用 JS 来写的,贴上我的 github : https://github.com/dnshi/Leetcode
    Youthink
        4
    Youthink  
    OP
       2016-03-19 08:50:49 +08:00
    @mikicomo 做前端,挺喜欢 Js 的
    Youthink
        5
    Youthink  
    OP
       2016-03-19 09:00:37 +08:00
    @dnshi 已 star ,学习一下
    hxtheone
        6
    hxtheone  
       2016-03-19 09:55:50 +08:00
    已 star, 加油, 我也是用 JS 刷的

    https://github.com/MrHuxu/leetcode

    不过已经中断一段时间了, 更多在折腾别的项目= =
    theFool
        7
    theFool  
       2016-03-19 10:06:21 +08:00
    同样也用 js 刷, 不过最近在忙其他..

    https://github.com/theFool32/LeetCode


    另外好想吐槽下楼主的 1_TwoSum.js ...
    rebornix
        8
    rebornix  
       2016-03-19 10:19:41 +08:00
    同 @theFool ,楼主的 TwoSum ,复杂度可能没法过吧?
    allan888
        9
    allan888  
       2016-03-19 11:44:19 +08:00
    楼主的 twoSum 有种萌感。
    我也安利一发我的 Java 版本:
    https://github.com/jieaozhu/leetcode
    chinabingwei
        10
    chinabingwei  
       2016-03-19 12:26:31 +08:00
    一起来用 Python 刷吧 ,+_+
    iugo
        11
    iugo  
       2016-03-19 15:35:37 +08:00
    https://leetcode.com/submissions/detail/56708879/

    我本地测试通过, 但是提交后提示内存溢出, 求解.
    dnshi
        12
    dnshi  
       2016-03-19 15:51:27 +08:00
    @iugo 你把代码直接贴出来或者截图来看下吧
    iugo
        13
    iugo  
       2016-03-19 15:56:39 +08:00
    @dnshi 好像不登录没办法看到.

    换别处: https://jsfiddle.net/e9b0jesr/1/
    iugo
        14
    iugo  
       2016-03-19 17:05:10 +08:00
    @dnshi 刚才没看清题, 改了改: https://jsfiddle.net/e9b0jesr/2/

    Custom Testcase 添加了一些数字通过了, 但是提交的时候还是内存错误 Memory Limit Exceeded
    Youthink
        15
    Youthink  
    OP
       2016-03-19 19:09:03 +08:00
    @chinabingwei 人生苦短,用 python
    Youthink
        16
    Youthink  
    OP
       2016-03-19 19:12:45 +08:00
    @allan888 是我写太简单了吗?要降低一下复杂度吗?
    Youthink
        17
    Youthink  
    OP
       2016-03-19 19:13:33 +08:00
    @roku Python 也不错
    Youthink
        18
    Youthink  
    OP
       2016-03-19 19:14:15 +08:00
    @theFool 学习一下
    pimin
        19
    pimin  
       2016-03-19 19:21:53 +08:00 via Android
    我用 Python 刚开始刷
    但是我经常题目都看不懂怎么破?
    Youthink
        20
    Youthink  
    OP
       2016-03-19 19:25:04 +08:00
    @rebornix 因为两层 for 循环?
    pengtikui
        21
    pengtikui  
       2016-03-19 20:22:59 +08:00
    这位同学,又碰见你了 (´・ω・`)
    Youthink
        22
    Youthink  
    OP
       2016-03-19 20:44:14 +08:00
    @pimin 找工具翻译一下呗
    Youthink
        23
    Youthink  
    OP
       2016-03-19 20:45:23 +08:00
    @pengtikui 呵呵,”猿“家路窄
    xcatliu
        24
    xcatliu  
       2016-03-19 22:04:37 +08:00
    allan888
        25
    allan888  
       2016-03-19 22:57:33 +08:00
    @Youthink 两个 for 是 O(n*n)的时间,按理来说过不了才对。
    这题希望的是让用哈希表做到 O(n)的复杂度。
    whahuzhihao
        26
    whahuzhihao  
       2016-03-19 23:13:36 +08:00
    以前也用 js 做 leetcode 感觉 js 写算法题 尤其是数据结构真是简单明了
    BOYPT
        27
    BOYPT  
       2016-03-20 01:44:43 +08:00
    看楼主介绍才知道这个 leetcode ,上去小试了两题
    发现平时我代码里面都是用 jquery 和 underscore ,像遍历对象之类的事情居然想不起来怎么写……
    duteng612
        28
    duteng612  
       2016-03-20 02:39:26 +08:00
    https://github.com/duteng/leetcode
    52 道题,很久没刷了
    Youthink
        29
    Youthink  
    OP
       2016-03-20 13:12:30 +08:00
    @xcatliu 已 star 学习一下
    Youthink
        30
    Youthink  
    OP
       2016-03-20 13:13:08 +08:00
    @whahuzhihao 嘿嘿, js 语言精粹
    Youthink
        31
    Youthink  
    OP
       2016-03-20 13:13:47 +08:00
    @BOYPT 我也是在别人博客看到的
    Youthink
        32
    Youthink  
    OP
       2016-03-20 13:14:47 +08:00
    @allan888 通过了啊,我试试哈希表,怪不得,别人都不是这样写的
    caiyue1993
        33
    caiyue1993  
       2016-03-20 14:39:53 +08:00
    我在用 Swift 刷》。。
    cs1707
        34
    cs1707  
       2016-03-20 18:39:55 +08:00
    Youthink
        35
    Youthink  
    OP
       2016-03-20 20:18:25 +08:00
    @cs1707 刷起~~
    blingbling55555
        37
    blingbling55555  
       2017-02-28 20:30:29 +08:00
    打开楼主 github 默默滚回来,哈哈哈楼主你这样子让一个正打算用 JS 刷题的人表示很难过呀(摊手)

    楼主你是不是发完这个贴没多久就放弃了哈哈哈。 Anyway ,加油!坚持!共勉!
    lxfxf
        38
    lxfxf  
       2017-04-23 13:18:50 +08:00
    @blingbling55555 哈哈哈,我也顺手点了一下...
    wwwap
        39
    wwwap  
       2019-08-25 20:04:19 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2901 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 13:58 · PVG 21:58 · LAX 06:58 · JFK 09:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.