摘要:
1、LCS 2、CSD: 1、s1.length==0,return s2.length; 2、s2.length==0,return s1.length; 3、if s1.charat(i)==s2.charat(j),res[i][j]=res[i-1][j-1] else res[i][j]= 阅读全文
摘要:
One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文
摘要:
Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the nod... 阅读全文
摘要:
http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm.html 阅读全文
摘要:
标题:Bitwise AND of Numbers Range通过率:25.7%难度:中等Given a range [m, n] where 0 >=1 9 n>>=110 offset+=111 return m<<offset 阅读全文
摘要:
标题:Remove Linked List Elements通过率:30.5%难度:简单Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 -->... 阅读全文
摘要:
标题:Happy Number通过率:34.3%难度:简单Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Start... 阅读全文
摘要:
标题:Rotate List通过率:21.8%难度:中等Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,ret... 阅读全文
摘要:
标题:Gas Station通过率:25.7%难度:中等There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimite... 阅读全文
摘要:
标题:Reverse Linked List II通过率:26.2%难度:中等Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m=... 阅读全文