posted @ 2016-02-16 21:31 cKK 阅读(126) 评论(0) 推荐(0) 编辑
摘要:
Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
摘要:
public void reverse (){ Node end =null,p,q; p=head; //p代表当前节点,end代表翻转后p后面的,q代表翻转前p后面的 while(p!=null){ //如果当前节点不为空 q=p.next; //q赋值为p后面的节点 p.next=end; / 阅读全文
posted @ 2016-02-16 14:41 cKK 阅读(262) 评论(0) 推荐(0) 编辑
摘要:
Implement pow(x, n). double sum = 1; if (n > 0) { while ((n--) > 0) sum *= x; return sum; } else if (n < 0) { while ((n++) < 0) sum /= x; } return sum 阅读全文
posted @ 2016-01-27 16:31 cKK 阅读(233) 评论(0) 推荐(0) 编辑
摘要:
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ... 阅读全文
posted @ 2016-01-27 13:16 cKK 阅读(191) 评论(0) 推荐(0) 编辑
摘要:
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2016-01-26 23:36 cKK 阅读(98) 评论(0) 推荐(0) 编辑
摘要:
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists./** * Def... 阅读全文
posted @ 2016-01-26 22:11 cKK 阅读(183) 评论(0) 推荐(0) 编辑
摘要:
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After ... 阅读全文
posted @ 2016-01-26 20:47 cKK 阅读(155) 评论(0) 推荐(0) 编辑
摘要:
Write a function to find the longest common prefix string amongst an array of strings.Subscribe to see which companies asked this question }public cl... 阅读全文
posted @ 2016-01-26 15:11 cKK 阅读(148) 评论(0) 推荐(0) 编辑