摘要:
这道题要注意的Corner Case是:如果n比这个LinkedList的size大,那么就需要直接返回Head,如果相等,就把head删掉,返回head.next;基本做的方法呢,还是Runner Technique. 由于有可能head会被删掉,所以最好还是使用一个dummy node,dumm 阅读全文
posted @ 2014-05-09 04:55
neverlandly
阅读(377)
评论(0)
推荐(0)
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文
posted @ 2014-05-09 04:20
neverlandly
阅读(333)
评论(0)
推荐(0)
摘要:
方法二(推荐方法1): 新的Linkedlist不以任何现有List为依托,维护一个dummmy node和当前节点ListNode cur,把两个list的元素往里面插入作为cur.next,每次不new一个新的ListNode, 而是用已有的。相较于法一最后需要讨论两个list各自没有走完的情况 阅读全文
posted @ 2014-05-09 03:38
neverlandly
阅读(825)
评论(0)
推荐(0)
浙公网安备 33010602011771号