Design Log Storage


  • 0

    Click here to see the full article post


  • 0

    The code is wrong for case:
    ["LogSystem","put","put","put","retrieve"]
    [[],[1,"2017:01:31:23:59:59"],[2,"2017:02:01:23:59:59"],[3,"2017:01:31:00:00:00"],["2017:01:30:00:00:00","2017:02:01:00:00:00","Hour"]]

    It returns [3] which indeed should be [1,3].


  • 0

    @mzchen It is assumed that every month contains max of 30 days. Anyways I have changed the formula lin convert function Now the code works fine for your test case also. Thanks.


  • 0
    W

    2017:01:31:23:59:59 can also represented as 180131235959, this way can save lots of calculation at put()/retrieval() where only year needs a subtract.


  • 0

    @whyseahike Nice Idea. You can do that as well. Thanks.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.