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

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

  •  
  •   JasonLaw · 338 天前 · 1481 次点击
    这是一个创建于 338 天前的主题,其中的信息可能已经有所发展或是发生改变。

    第 1 条附言  ·  230 天前

    2023-08-30

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

    我也不怎么做 hard 。BTW ,LeetCode 跟数学没有太大关系。
    dif
        9
    dif  
       337 天前
    @JasonLaw 我的目的主要是为了解决焦虑,结果做着做着更焦虑了。得换个心态。
    waytodelay
        10
    waytodelay  
       337 天前
    @JasonLaw 像动态规划那些,不是要自己也得有个推导的数学公式,这种跟数学还没关系吗
    JasonLaw
        11
    JasonLaw  
    OP
       337 天前
    @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
       337 天前
    @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  
       336 天前
    刷了 200 道就开始腻了。现在每天就刷个日常题,保持一下思维
    waytodelay
        14
    waytodelay  
       336 天前
    @JasonLaw 那我还得细细研究下,感觉 f(n)是怎么一步步来的还是需要一些思考
    JasonLaw
        15
    JasonLaw  
    OP
       336 天前 via iPhone
    @waytodelay #14 f(n) = f(n-1) + f(n-2),需要一些思考没错,但是这个跟数学没有太大关系。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   953 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:05 · PVG 05:05 · LAX 14:05 · JFK 17:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.