摘要:
232 Implement Queue using Stacks用2个stack 完成 代码如下class Queue: # initialize your data structure here. def __init__(self): self.stackA = [] ... 阅读全文
摘要:
234 Palindrome Linked List这道题如果不要求space O(1) 代码写起来就相当简单。 但是要求 O(1),唯一的方法就是reverse 前半部分linked List 在做比较, 稍微注意长度为奇偶时一点小小的区别。写起来还是很费劲的class Solution: ... 阅读全文
摘要:
238 Product of Array Except Self从头部 和 尾部各扫描一遍class Solution: # @param {integer[]} nums # @return {integer[]} def productExceptSelf(self, nums... 阅读全文