差不多一年了,完成了 LeetCode 500 道题咯 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
请不要在回答技术问题时复制粘贴 AI 生成的内容
JasonLaw
V2EX    程序员

差不多一年了,完成了 LeetCode 500 道题咯

  •  
  •   asonLaw 2023-05-14 20:09:15 +08:00 2199 次点击
    这是一个创建于 922 天前的主题,其中的信息可能已经有所发展或是发生改变。

    第 1 条附言    2023-08-30 12:50:49 +08:00

    2023-08-30

    15 条回复    2023-05-16 14:25:26 +08:00
    zpxshl
        1
    zpxshl  
       2023-05-14 21:58:53 +08:00 via Android
    羡慕。工作后一题都不想刷,完全不想动脑。。。
    EHemingway
        2
    EHemingway  
       2023-05-14 22:34:57 +08:00
    好狠
    dif
        3
    dif  
       2023-05-15 09:21:56 +08:00
    羡慕,我才刷了两周就坚持不下去了。
    JasonLaw
        4
    JasonLaw  
    OP
       2023-05-15 10:39:23 +08:00 via iPhone
    @zpxshl #1
    @dif #3
    我是喜欢整个解题过程,所以才能一直坚持下去。
    x43125
        5
    x43125  
       2023-05-15 10:43:15 +08:00
    同不想刷,刷两题就忘了,刷的时候也是,静不下来想,稍微想不到就想看题解
    waytodelay
        6
    waytodelay  
       2023-05-15 10:47:08 +08:00
    好佩服,坚持下去的动力是什么?
    最近要找工作所以也有开始刷一些,如果只是比较简单的涉及数据结构的题,就感觉还好
    那些要动用到数学思维的,就很头疼,主要自己数学也很差
    JasonLaw
        7
    JasonLaw  
    OP
       2023-05-15 11:10:15 +08:00 via iPhone
    @x43125 #5 如果是刚开始的话,建议跟着 Blind 75 做,理解每一种类型题目的解法,千万不要记答案。
    JasonLaw
        8
    JasonLaw  
    OP
       2023-05-15 11:17:17 +08:00 via iPhone
    @waytodelay #6 学习 Python 算是一个理由,最重要的是,让自己时刻保持 problem solving 的能力,还可以学到别人解决问题的想法,而且我也很享受解题过程。

    我也不怎么做 hard 。BTW ,LeetCode 跟数学没有太大关系。
    dif
        9
    dif  
       2023-05-15 12:07:31 +08:00
    @JasonLaw 我的目的主要是为了解决焦虑,结果做着做着更焦虑了。得换个心态。
    waytodelay
        10
    waytodelay  
       2023-05-15 14:45:49 +08:00
    @JasonLaw 像动态规划那些,不是要自己也得有个推导的数学公式,这种跟数学还没关系吗
    JasonLaw
        11
    JasonLaw  
    OP
       2023-05-15 15:14:47 +08:00
    @waytodelay #10 没关系,一般人都会将动态规划错误地同等于 bottom-up ,但是动态规划包含了 bottom-up 和 top-down ,而 top-down 相对来说更加容易实现,当你完成了 top-down 之后,你就会很容易得出 bottom-up 版本。

    From Poe - Sage:
    Dynamic programming can be implemented using a bottom-up approach or a top-down approach.

    In the bottom-up approach, also known as the "tabulation" method, the solution to a problem is computed iteratively starting from the smallest subproblem and building up to the larger problem. This approach is typically implemented using a table or array to store intermediate results. The advantage of the bottom-up approach is that it often has better space complexity than the top-down approach, since it avoids the overhead of recursion.

    In the top-down approach, also known as the "memoization" method, the solution to a problem is computed recursively, but with the added step of caching intermediate results so that they can be reused later. This approach can be more intuitive and easier to implement than the bottom-up approach, but it can suffer from the overhead of recursion and may not be as efficient in terms of space complexity.

    Both approaches have their advantages and disadvantages depending on the problem at hand.
    JasonLaw
        12
    JasonLaw  
    OP
       2023-05-15 15:22:48 +08:00
    @waytodelay #10

    以 Fibonacci sequence 为例,在 top-down 版本中,我们知道 f(n) = f(n-1) + f(n-2),然后 f(1)和 f(2)为 base case 。那么在 bottom-up 版本中,我们就可以以 f(1)和 f(2)为起点,一点一点往上解决更大的问题。

    cangcang
        13
    cangcang  
       2023-05-16 09:31:23 +08:00
    刷了 200 道就开始腻了。现在每天就刷个日常题,保持一下思维
    waytodelay
        14
    waytodelay  
       2023-05-16 14:21:05 +08:00
    @JasonLaw 那我还得细细研究下,感觉 f(n)是怎么一步步来的还是需要一些思考
    JasonLaw
        15
    JasonLaw  
    OP
       2023-05-16 14:25:26 +08:00 via iPhone
    @waytodelay #14 f(n) = f(n-1) + f(n-2),需要一些思考没错,但是这个跟数学没有太大关系。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2291 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 16:01 PVG 00:01 LAX 08:01 JFK 11:01
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86