2014年10月1日

Divide Two Integers

摘要: Divide two integers without using multiplication, division and mod operator. 方法一:暴力破解,不断用被除数减去除数,直至出现负数停止,铁定超时。 方法二:对方法一的改进,每次寻找 满足2k-1 * 除数 <= 被除数 < 阅读全文

posted @ 2014-10-01 23:24 bug睡的略爽 阅读(130) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted Array I&&II

摘要: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文

posted @ 2014-10-01 17:06 bug睡的略爽 阅读(92) 评论(0) 推荐(0) 编辑

Reverse Nodes in k-Group

摘要: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then l 阅读全文

posted @ 2014-10-01 16:57 bug睡的略爽 阅读(176) 评论(0) 推荐(0) 编辑

Swap Nodes in Pairs

摘要: Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文

posted @ 2014-10-01 11:38 bug睡的略爽 阅读(154) 评论(0) 推荐(0) 编辑

Merge k Sorted Lists

摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 方法一:暴力破解,1和2合并,合并后再和3合并,合并后再和4合并。。。如此下去一直将所有链表节点全部合 阅读全文

posted @ 2014-10-01 11:10 bug睡的略爽 阅读(155) 评论(0) 推荐(0) 编辑

导航