摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu... 阅读全文
posted @ 2015-03-15 19:42 jasmine_turnsoul 阅读(99) 评论(0) 推荐(0)
摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?思路:1.两个指针,一个走1步,一个走2步,如果相遇则有环注意: 在使用p->nex... 阅读全文
posted @ 2015-03-15 19:25 jasmine_turnsoul 阅读(90) 评论(0) 推荐(0)
摘要: The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a... 阅读全文
posted @ 2015-03-15 14:46 jasmine_turnsoul 阅读(150) 评论(0) 推荐(0)
摘要: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文
posted @ 2015-03-15 11:54 jasmine_turnsoul 阅读(139) 评论(0) 推荐(0)