whalegia
V2EX  ›  问与答

[ LeetCode]最大值子序列,这个代码是不是算 cheating 呀?

  •  
  •   whalegia · Dec 5, 2014 · 2800 views
    This topic created in 4263 days ago, the information mentioned may be changed or developed.
    代码如下:


    就是要是发现输入的测试有小于 -10000 的例子的时候,就把 MaxSum 的初始值置为比测试值更小的值?
    2 replies    2014-12-05 05:10:48 +08:00
    shuding
        1
    shuding  
       Dec 5, 2014   ❤️ 1
    漂亮的做法是初始化 `MaxSum` 为 `A[0]`...
    whalegia
        2
    whalegia  
    OP
       Dec 5, 2014
    @shuding 是噢,谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3865 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 05:12 · PVG 13:12 · LAX 22:12 · JFK 01:12
    ♥ Do have faith in what you're doing.