摘要:
Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2016-10-08 15:23
Machelsky
阅读(105)
评论(0)
推荐(0)
摘要:
Sort a linked list using insertion sort. 思路:插入排序,就是把node插入到左边的链表中。用一个dummynode来构造左边的链表。要是比最左边的数还小,就插到最左边也就是dummy.next。如果不是,则linear search左边的链表插入。 阅读全文
posted @ 2016-10-08 15:13
Machelsky
阅读(113)
评论(0)
推荐(0)
摘要:
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 @ 2016-10-08 14:39
Machelsky
阅读(117)
评论(0)
推荐(0)
摘要:
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2016-10-08 14:26
Machelsky
阅读(172)
评论(0)
推荐(0)
摘要:
Implement int sqrt(int x). 二分法,找中值。注意不能用low<high来判断。举例:sqrt(5),low<high的话一直在2的右边搜索,最后low=3 high=3是不正确的,要再进入循环去得到最后的结果。 阅读全文
posted @ 2016-10-08 14:04
Machelsky
阅读(123)
评论(0)
推荐(0)