
AC and Best Answer
1 |
def (self, ops): |
Time complexity:O(n)
Space complexity: O(2)
keep a stack to record score change and a sum for current sum
when a new operation happen, update the stack and the sum

1 |
def (self, ops): |
Time complexity:O(n)
Space complexity: O(2)
keep a stack to record score change and a sum for current sum
when a new operation happen, update the stack and the sum
近期评论